
bin/kernel：     文件格式 elf32-i386


Disassembly of section .text:

c0100000 <kern_entry>:

.text
.globl kern_entry
kern_entry:
    # load pa of boot pgdir
    movl $REALLOC(__boot_pgdir), %eax
c0100000:	b8 00 f0 1a 00       	mov    $0x1af000,%eax
    movl %eax, %cr3
c0100005:	0f 22 d8             	mov    %eax,%cr3

    # enable paging
    movl %cr0, %eax
c0100008:	0f 20 c0             	mov    %cr0,%eax
    orl $(CR0_PE | CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_TS | CR0_EM | CR0_MP), %eax
c010000b:	0d 2f 00 05 80       	or     $0x8005002f,%eax
    andl $~(CR0_TS | CR0_EM), %eax
c0100010:	83 e0 f3             	and    $0xfffffff3,%eax
    movl %eax, %cr0
c0100013:	0f 22 c0             	mov    %eax,%cr0

    # update eip
    # now, eip = 0x1.....
    leal next, %eax
c0100016:	8d 05 1e 00 10 c0    	lea    0xc010001e,%eax
    # set eip = KERNBASE + 0x1.....
    jmp *%eax
c010001c:	ff e0                	jmp    *%eax

c010001e <next>:
next:

    # unmap va 0 ~ 4M, it's temporary mapping
    xorl %eax, %eax
c010001e:	31 c0                	xor    %eax,%eax
    movl %eax, __boot_pgdir
c0100020:	a3 00 f0 1a c0       	mov    %eax,0xc01af000

    # set ebp, esp
    movl $0x0, %ebp
c0100025:	bd 00 00 00 00       	mov    $0x0,%ebp
    # the kernel stack region is from bootstack -- bootstacktop,
    # the kernel stack size is KSTACKSIZE (8KB)defined in memlayout.h
    movl $bootstacktop, %esp
c010002a:	bc 00 e0 12 c0       	mov    $0xc012e000,%esp
    # now kernel stack is ready , call the first C function
    call kern_init
c010002f:	e8 02 00 00 00       	call   c0100036 <kern_init>

c0100034 <spin>:

# should never get here
spin:
    jmp spin
c0100034:	eb fe                	jmp    c0100034 <spin>

c0100036 <kern_init>:
int kern_init(void) __attribute__((noreturn));
void grade_backtrace(void);
static void lab1_switch_test(void);

int
kern_init(void) {
c0100036:	f3 0f 1e fb          	endbr32 
c010003a:	55                   	push   %ebp
c010003b:	89 e5                	mov    %esp,%ebp
c010003d:	83 ec 28             	sub    $0x28,%esp
    extern char edata[], end[];
    memset(edata, 0, end - edata);
c0100040:	b8 58 41 1b c0       	mov    $0xc01b4158,%eax
c0100045:	2d 00 10 1b c0       	sub    $0xc01b1000,%eax
c010004a:	89 44 24 08          	mov    %eax,0x8(%esp)
c010004e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100055:	00 
c0100056:	c7 04 24 00 10 1b c0 	movl   $0xc01b1000,(%esp)
c010005d:	e8 cb b7 00 00       	call   c010b82d <memset>

    cons_init();                // init the console
c0100062:	e8 be 1f 00 00       	call   c0102025 <cons_init>

    const char *message = "(THU.CST) os is loading ...";
c0100067:	c7 45 f4 60 c1 10 c0 	movl   $0xc010c160,-0xc(%ebp)
    cprintf("%s\n\n", message);
c010006e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100071:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100075:	c7 04 24 7c c1 10 c0 	movl   $0xc010c17c,(%esp)
c010007c:	e8 50 02 00 00       	call   c01002d1 <cprintf>

    print_kerninfo();
c0100081:	e8 02 0a 00 00       	call   c0100a88 <print_kerninfo>

    grade_backtrace();
c0100086:	e8 ac 00 00 00       	call   c0100137 <grade_backtrace>

    pmm_init();                 // init physical memory management
c010008b:	e8 c6 3e 00 00       	call   c0103f56 <pmm_init>

    pic_init();                 // init interrupt controller
c0100090:	e8 0b 21 00 00       	call   c01021a0 <pic_init>
    idt_init();                 // init interrupt descriptor table
c0100095:	e8 b0 22 00 00       	call   c010234a <idt_init>

    vmm_init();                 // init virtual memory management
c010009a:	e8 14 62 00 00       	call   c01062b3 <vmm_init>
    proc_init();                // init process table
c010009f:	e8 b0 ae 00 00       	call   c010af54 <proc_init>
    
    ide_init();                 // init ide devices
c01000a4:	e8 b1 0e 00 00       	call   c0100f5a <ide_init>
    swap_init();                // init swap
c01000a9:	e8 5a 74 00 00       	call   c0107508 <swap_init>

    clock_init();               // init clock interrupt
c01000ae:	e8 b9 16 00 00       	call   c010176c <clock_init>
    intr_enable();              // enable irq interrupt
c01000b3:	e8 34 22 00 00       	call   c01022ec <intr_enable>

    //LAB1: CAHLLENGE 1 If you try to do it, uncomment lab1_switch_test()
    // user/kernel mode switch test
    //lab1_switch_test();
    
    cpu_idle();                 // run idle process
c01000b8:	e8 5a b0 00 00       	call   c010b117 <cpu_idle>

c01000bd <grade_backtrace2>:
}

void __attribute__((noinline))
grade_backtrace2(int arg0, int arg1, int arg2, int arg3) {
c01000bd:	f3 0f 1e fb          	endbr32 
c01000c1:	55                   	push   %ebp
c01000c2:	89 e5                	mov    %esp,%ebp
c01000c4:	83 ec 18             	sub    $0x18,%esp
    mon_backtrace(0, NULL, NULL);
c01000c7:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01000ce:	00 
c01000cf:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01000d6:	00 
c01000d7:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01000de:	e8 04 0e 00 00       	call   c0100ee7 <mon_backtrace>
}
c01000e3:	90                   	nop
c01000e4:	c9                   	leave  
c01000e5:	c3                   	ret    

c01000e6 <grade_backtrace1>:

void __attribute__((noinline))
grade_backtrace1(int arg0, int arg1) {
c01000e6:	f3 0f 1e fb          	endbr32 
c01000ea:	55                   	push   %ebp
c01000eb:	89 e5                	mov    %esp,%ebp
c01000ed:	53                   	push   %ebx
c01000ee:	83 ec 14             	sub    $0x14,%esp
    grade_backtrace2(arg0, (int)&arg0, arg1, (int)&arg1);
c01000f1:	8d 4d 0c             	lea    0xc(%ebp),%ecx
c01000f4:	8b 55 0c             	mov    0xc(%ebp),%edx
c01000f7:	8d 5d 08             	lea    0x8(%ebp),%ebx
c01000fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01000fd:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0100101:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100105:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0100109:	89 04 24             	mov    %eax,(%esp)
c010010c:	e8 ac ff ff ff       	call   c01000bd <grade_backtrace2>
}
c0100111:	90                   	nop
c0100112:	83 c4 14             	add    $0x14,%esp
c0100115:	5b                   	pop    %ebx
c0100116:	5d                   	pop    %ebp
c0100117:	c3                   	ret    

c0100118 <grade_backtrace0>:

void __attribute__((noinline))
grade_backtrace0(int arg0, int arg1, int arg2) {
c0100118:	f3 0f 1e fb          	endbr32 
c010011c:	55                   	push   %ebp
c010011d:	89 e5                	mov    %esp,%ebp
c010011f:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace1(arg0, arg2);
c0100122:	8b 45 10             	mov    0x10(%ebp),%eax
c0100125:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100129:	8b 45 08             	mov    0x8(%ebp),%eax
c010012c:	89 04 24             	mov    %eax,(%esp)
c010012f:	e8 b2 ff ff ff       	call   c01000e6 <grade_backtrace1>
}
c0100134:	90                   	nop
c0100135:	c9                   	leave  
c0100136:	c3                   	ret    

c0100137 <grade_backtrace>:

void
grade_backtrace(void) {
c0100137:	f3 0f 1e fb          	endbr32 
c010013b:	55                   	push   %ebp
c010013c:	89 e5                	mov    %esp,%ebp
c010013e:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace0(0, (int)kern_init, 0xffff0000);
c0100141:	b8 36 00 10 c0       	mov    $0xc0100036,%eax
c0100146:	c7 44 24 08 00 00 ff 	movl   $0xffff0000,0x8(%esp)
c010014d:	ff 
c010014e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100152:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100159:	e8 ba ff ff ff       	call   c0100118 <grade_backtrace0>
}
c010015e:	90                   	nop
c010015f:	c9                   	leave  
c0100160:	c3                   	ret    

c0100161 <lab1_print_cur_status>:

static void
lab1_print_cur_status(void) {
c0100161:	f3 0f 1e fb          	endbr32 
c0100165:	55                   	push   %ebp
c0100166:	89 e5                	mov    %esp,%ebp
c0100168:	83 ec 28             	sub    $0x28,%esp
    static int round = 0;
    uint16_t reg1, reg2, reg3, reg4;
    asm volatile (
c010016b:	8c 4d f6             	mov    %cs,-0xa(%ebp)
c010016e:	8c 5d f4             	mov    %ds,-0xc(%ebp)
c0100171:	8c 45 f2             	mov    %es,-0xe(%ebp)
c0100174:	8c 55 f0             	mov    %ss,-0x10(%ebp)
            "mov %%cs, %0;"
            "mov %%ds, %1;"
            "mov %%es, %2;"
            "mov %%ss, %3;"
            : "=m"(reg1), "=m"(reg2), "=m"(reg3), "=m"(reg4));
    cprintf("%d: @ring %d\n", round, reg1 & 3);
c0100177:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010017b:	83 e0 03             	and    $0x3,%eax
c010017e:	89 c2                	mov    %eax,%edx
c0100180:	a1 00 10 1b c0       	mov    0xc01b1000,%eax
c0100185:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100189:	89 44 24 04          	mov    %eax,0x4(%esp)
c010018d:	c7 04 24 81 c1 10 c0 	movl   $0xc010c181,(%esp)
c0100194:	e8 38 01 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  cs = %x\n", round, reg1);
c0100199:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010019d:	89 c2                	mov    %eax,%edx
c010019f:	a1 00 10 1b c0       	mov    0xc01b1000,%eax
c01001a4:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001a8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ac:	c7 04 24 8f c1 10 c0 	movl   $0xc010c18f,(%esp)
c01001b3:	e8 19 01 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  ds = %x\n", round, reg2);
c01001b8:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c01001bc:	89 c2                	mov    %eax,%edx
c01001be:	a1 00 10 1b c0       	mov    0xc01b1000,%eax
c01001c3:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001c7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001cb:	c7 04 24 9d c1 10 c0 	movl   $0xc010c19d,(%esp)
c01001d2:	e8 fa 00 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  es = %x\n", round, reg3);
c01001d7:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01001db:	89 c2                	mov    %eax,%edx
c01001dd:	a1 00 10 1b c0       	mov    0xc01b1000,%eax
c01001e2:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001e6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ea:	c7 04 24 ab c1 10 c0 	movl   $0xc010c1ab,(%esp)
c01001f1:	e8 db 00 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  ss = %x\n", round, reg4);
c01001f6:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c01001fa:	89 c2                	mov    %eax,%edx
c01001fc:	a1 00 10 1b c0       	mov    0xc01b1000,%eax
c0100201:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100205:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100209:	c7 04 24 b9 c1 10 c0 	movl   $0xc010c1b9,(%esp)
c0100210:	e8 bc 00 00 00       	call   c01002d1 <cprintf>
    round ++;
c0100215:	a1 00 10 1b c0       	mov    0xc01b1000,%eax
c010021a:	40                   	inc    %eax
c010021b:	a3 00 10 1b c0       	mov    %eax,0xc01b1000
}
c0100220:	90                   	nop
c0100221:	c9                   	leave  
c0100222:	c3                   	ret    

c0100223 <lab1_switch_to_user>:

static void
lab1_switch_to_user(void) {
c0100223:	f3 0f 1e fb          	endbr32 
c0100227:	55                   	push   %ebp
c0100228:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 : TODO
}
c010022a:	90                   	nop
c010022b:	5d                   	pop    %ebp
c010022c:	c3                   	ret    

c010022d <lab1_switch_to_kernel>:

static void
lab1_switch_to_kernel(void) {
c010022d:	f3 0f 1e fb          	endbr32 
c0100231:	55                   	push   %ebp
c0100232:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 :  TODO
}
c0100234:	90                   	nop
c0100235:	5d                   	pop    %ebp
c0100236:	c3                   	ret    

c0100237 <lab1_switch_test>:

static void
lab1_switch_test(void) {
c0100237:	f3 0f 1e fb          	endbr32 
c010023b:	55                   	push   %ebp
c010023c:	89 e5                	mov    %esp,%ebp
c010023e:	83 ec 18             	sub    $0x18,%esp
    lab1_print_cur_status();
c0100241:	e8 1b ff ff ff       	call   c0100161 <lab1_print_cur_status>
    cprintf("+++ switch to  user  mode +++\n");
c0100246:	c7 04 24 c8 c1 10 c0 	movl   $0xc010c1c8,(%esp)
c010024d:	e8 7f 00 00 00       	call   c01002d1 <cprintf>
    lab1_switch_to_user();
c0100252:	e8 cc ff ff ff       	call   c0100223 <lab1_switch_to_user>
    lab1_print_cur_status();
c0100257:	e8 05 ff ff ff       	call   c0100161 <lab1_print_cur_status>
    cprintf("+++ switch to kernel mode +++\n");
c010025c:	c7 04 24 e8 c1 10 c0 	movl   $0xc010c1e8,(%esp)
c0100263:	e8 69 00 00 00       	call   c01002d1 <cprintf>
    lab1_switch_to_kernel();
c0100268:	e8 c0 ff ff ff       	call   c010022d <lab1_switch_to_kernel>
    lab1_print_cur_status();
c010026d:	e8 ef fe ff ff       	call   c0100161 <lab1_print_cur_status>
}
c0100272:	90                   	nop
c0100273:	c9                   	leave  
c0100274:	c3                   	ret    

c0100275 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
c0100275:	f3 0f 1e fb          	endbr32 
c0100279:	55                   	push   %ebp
c010027a:	89 e5                	mov    %esp,%ebp
c010027c:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c010027f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100282:	89 04 24             	mov    %eax,(%esp)
c0100285:	e8 cc 1d 00 00       	call   c0102056 <cons_putc>
    (*cnt) ++;
c010028a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010028d:	8b 00                	mov    (%eax),%eax
c010028f:	8d 50 01             	lea    0x1(%eax),%edx
c0100292:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100295:	89 10                	mov    %edx,(%eax)
}
c0100297:	90                   	nop
c0100298:	c9                   	leave  
c0100299:	c3                   	ret    

c010029a <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
c010029a:	f3 0f 1e fb          	endbr32 
c010029e:	55                   	push   %ebp
c010029f:	89 e5                	mov    %esp,%ebp
c01002a1:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c01002a4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, &cnt, fmt, ap);
c01002ab:	8b 45 0c             	mov    0xc(%ebp),%eax
c01002ae:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01002b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01002b5:	89 44 24 08          	mov    %eax,0x8(%esp)
c01002b9:	8d 45 f4             	lea    -0xc(%ebp),%eax
c01002bc:	89 44 24 04          	mov    %eax,0x4(%esp)
c01002c0:	c7 04 24 75 02 10 c0 	movl   $0xc0100275,(%esp)
c01002c7:	e8 cd b8 00 00       	call   c010bb99 <vprintfmt>
    return cnt;
c01002cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01002cf:	c9                   	leave  
c01002d0:	c3                   	ret    

c01002d1 <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
c01002d1:	f3 0f 1e fb          	endbr32 
c01002d5:	55                   	push   %ebp
c01002d6:	89 e5                	mov    %esp,%ebp
c01002d8:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c01002db:	8d 45 0c             	lea    0xc(%ebp),%eax
c01002de:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vcprintf(fmt, ap);
c01002e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002e4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01002e8:	8b 45 08             	mov    0x8(%ebp),%eax
c01002eb:	89 04 24             	mov    %eax,(%esp)
c01002ee:	e8 a7 ff ff ff       	call   c010029a <vcprintf>
c01002f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c01002f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01002f9:	c9                   	leave  
c01002fa:	c3                   	ret    

c01002fb <cputchar>:

/* cputchar - writes a single character to stdout */
void
cputchar(int c) {
c01002fb:	f3 0f 1e fb          	endbr32 
c01002ff:	55                   	push   %ebp
c0100300:	89 e5                	mov    %esp,%ebp
c0100302:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c0100305:	8b 45 08             	mov    0x8(%ebp),%eax
c0100308:	89 04 24             	mov    %eax,(%esp)
c010030b:	e8 46 1d 00 00       	call   c0102056 <cons_putc>
}
c0100310:	90                   	nop
c0100311:	c9                   	leave  
c0100312:	c3                   	ret    

c0100313 <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
c0100313:	f3 0f 1e fb          	endbr32 
c0100317:	55                   	push   %ebp
c0100318:	89 e5                	mov    %esp,%ebp
c010031a:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c010031d:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
c0100324:	eb 13                	jmp    c0100339 <cputs+0x26>
        cputch(c, &cnt);
c0100326:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c010032a:	8d 55 f0             	lea    -0x10(%ebp),%edx
c010032d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0100331:	89 04 24             	mov    %eax,(%esp)
c0100334:	e8 3c ff ff ff       	call   c0100275 <cputch>
    while ((c = *str ++) != '\0') {
c0100339:	8b 45 08             	mov    0x8(%ebp),%eax
c010033c:	8d 50 01             	lea    0x1(%eax),%edx
c010033f:	89 55 08             	mov    %edx,0x8(%ebp)
c0100342:	0f b6 00             	movzbl (%eax),%eax
c0100345:	88 45 f7             	mov    %al,-0x9(%ebp)
c0100348:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
c010034c:	75 d8                	jne    c0100326 <cputs+0x13>
    }
    cputch('\n', &cnt);
c010034e:	8d 45 f0             	lea    -0x10(%ebp),%eax
c0100351:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100355:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
c010035c:	e8 14 ff ff ff       	call   c0100275 <cputch>
    return cnt;
c0100361:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0100364:	c9                   	leave  
c0100365:	c3                   	ret    

c0100366 <getchar>:

/* getchar - reads a single non-zero character from stdin */
int
getchar(void) {
c0100366:	f3 0f 1e fb          	endbr32 
c010036a:	55                   	push   %ebp
c010036b:	89 e5                	mov    %esp,%ebp
c010036d:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = cons_getc()) == 0)
c0100370:	90                   	nop
c0100371:	e8 21 1d 00 00       	call   c0102097 <cons_getc>
c0100376:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100379:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010037d:	74 f2                	je     c0100371 <getchar+0xb>
        /* do nothing */;
    return c;
c010037f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100382:	c9                   	leave  
c0100383:	c3                   	ret    

c0100384 <readline>:
 * The readline() function returns the text of the line read. If some errors
 * are happened, NULL is returned. The return value is a global variable,
 * thus it should be copied before it is used.
 * */
char *
readline(const char *prompt) {
c0100384:	f3 0f 1e fb          	endbr32 
c0100388:	55                   	push   %ebp
c0100389:	89 e5                	mov    %esp,%ebp
c010038b:	83 ec 28             	sub    $0x28,%esp
    if (prompt != NULL) {
c010038e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100392:	74 13                	je     c01003a7 <readline+0x23>
        cprintf("%s", prompt);
c0100394:	8b 45 08             	mov    0x8(%ebp),%eax
c0100397:	89 44 24 04          	mov    %eax,0x4(%esp)
c010039b:	c7 04 24 07 c2 10 c0 	movl   $0xc010c207,(%esp)
c01003a2:	e8 2a ff ff ff       	call   c01002d1 <cprintf>
    }
    int i = 0, c;
c01003a7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        c = getchar();
c01003ae:	e8 b3 ff ff ff       	call   c0100366 <getchar>
c01003b3:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (c < 0) {
c01003b6:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01003ba:	79 07                	jns    c01003c3 <readline+0x3f>
            return NULL;
c01003bc:	b8 00 00 00 00       	mov    $0x0,%eax
c01003c1:	eb 78                	jmp    c010043b <readline+0xb7>
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
c01003c3:	83 7d f0 1f          	cmpl   $0x1f,-0x10(%ebp)
c01003c7:	7e 28                	jle    c01003f1 <readline+0x6d>
c01003c9:	81 7d f4 fe 03 00 00 	cmpl   $0x3fe,-0xc(%ebp)
c01003d0:	7f 1f                	jg     c01003f1 <readline+0x6d>
            cputchar(c);
c01003d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01003d5:	89 04 24             	mov    %eax,(%esp)
c01003d8:	e8 1e ff ff ff       	call   c01002fb <cputchar>
            buf[i ++] = c;
c01003dd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01003e0:	8d 50 01             	lea    0x1(%eax),%edx
c01003e3:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01003e6:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01003e9:	88 90 20 10 1b c0    	mov    %dl,-0x3fe4efe0(%eax)
c01003ef:	eb 45                	jmp    c0100436 <readline+0xb2>
        }
        else if (c == '\b' && i > 0) {
c01003f1:	83 7d f0 08          	cmpl   $0x8,-0x10(%ebp)
c01003f5:	75 16                	jne    c010040d <readline+0x89>
c01003f7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01003fb:	7e 10                	jle    c010040d <readline+0x89>
            cputchar(c);
c01003fd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100400:	89 04 24             	mov    %eax,(%esp)
c0100403:	e8 f3 fe ff ff       	call   c01002fb <cputchar>
            i --;
c0100408:	ff 4d f4             	decl   -0xc(%ebp)
c010040b:	eb 29                	jmp    c0100436 <readline+0xb2>
        }
        else if (c == '\n' || c == '\r') {
c010040d:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c0100411:	74 06                	je     c0100419 <readline+0x95>
c0100413:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
c0100417:	75 95                	jne    c01003ae <readline+0x2a>
            cputchar(c);
c0100419:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010041c:	89 04 24             	mov    %eax,(%esp)
c010041f:	e8 d7 fe ff ff       	call   c01002fb <cputchar>
            buf[i] = '\0';
c0100424:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100427:	05 20 10 1b c0       	add    $0xc01b1020,%eax
c010042c:	c6 00 00             	movb   $0x0,(%eax)
            return buf;
c010042f:	b8 20 10 1b c0       	mov    $0xc01b1020,%eax
c0100434:	eb 05                	jmp    c010043b <readline+0xb7>
        c = getchar();
c0100436:	e9 73 ff ff ff       	jmp    c01003ae <readline+0x2a>
        }
    }
}
c010043b:	c9                   	leave  
c010043c:	c3                   	ret    

c010043d <__panic>:
/* *
 * __panic - __panic is called on unresolvable fatal errors. it prints
 * "panic: 'message'", and then enters the kernel monitor.
 * */
void
__panic(const char *file, int line, const char *fmt, ...) {
c010043d:	f3 0f 1e fb          	endbr32 
c0100441:	55                   	push   %ebp
c0100442:	89 e5                	mov    %esp,%ebp
c0100444:	83 ec 28             	sub    $0x28,%esp
    if (is_panic) {
c0100447:	a1 20 14 1b c0       	mov    0xc01b1420,%eax
c010044c:	85 c0                	test   %eax,%eax
c010044e:	75 5b                	jne    c01004ab <__panic+0x6e>
        goto panic_dead;
    }
    is_panic = 1;
c0100450:	c7 05 20 14 1b c0 01 	movl   $0x1,0xc01b1420
c0100457:	00 00 00 

    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
c010045a:	8d 45 14             	lea    0x14(%ebp),%eax
c010045d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel panic at %s:%d:\n    ", file, line);
c0100460:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100463:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100467:	8b 45 08             	mov    0x8(%ebp),%eax
c010046a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010046e:	c7 04 24 0a c2 10 c0 	movl   $0xc010c20a,(%esp)
c0100475:	e8 57 fe ff ff       	call   c01002d1 <cprintf>
    vcprintf(fmt, ap);
c010047a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010047d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100481:	8b 45 10             	mov    0x10(%ebp),%eax
c0100484:	89 04 24             	mov    %eax,(%esp)
c0100487:	e8 0e fe ff ff       	call   c010029a <vcprintf>
    cprintf("\n");
c010048c:	c7 04 24 26 c2 10 c0 	movl   $0xc010c226,(%esp)
c0100493:	e8 39 fe ff ff       	call   c01002d1 <cprintf>
    
    cprintf("stack trackback:\n");
c0100498:	c7 04 24 28 c2 10 c0 	movl   $0xc010c228,(%esp)
c010049f:	e8 2d fe ff ff       	call   c01002d1 <cprintf>
    print_stackframe();
c01004a4:	e8 31 07 00 00       	call   c0100bda <print_stackframe>
c01004a9:	eb 01                	jmp    c01004ac <__panic+0x6f>
        goto panic_dead;
c01004ab:	90                   	nop
    
    va_end(ap);

panic_dead:
    intr_disable();
c01004ac:	e8 47 1e 00 00       	call   c01022f8 <intr_disable>
    while (1) {
        kmonitor(NULL);
c01004b1:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01004b8:	e8 51 09 00 00       	call   c0100e0e <kmonitor>
c01004bd:	eb f2                	jmp    c01004b1 <__panic+0x74>

c01004bf <__warn>:
    }
}

/* __warn - like panic, but don't */
void
__warn(const char *file, int line, const char *fmt, ...) {
c01004bf:	f3 0f 1e fb          	endbr32 
c01004c3:	55                   	push   %ebp
c01004c4:	89 e5                	mov    %esp,%ebp
c01004c6:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
c01004c9:	8d 45 14             	lea    0x14(%ebp),%eax
c01004cc:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel warning at %s:%d:\n    ", file, line);
c01004cf:	8b 45 0c             	mov    0xc(%ebp),%eax
c01004d2:	89 44 24 08          	mov    %eax,0x8(%esp)
c01004d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01004d9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01004dd:	c7 04 24 3a c2 10 c0 	movl   $0xc010c23a,(%esp)
c01004e4:	e8 e8 fd ff ff       	call   c01002d1 <cprintf>
    vcprintf(fmt, ap);
c01004e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01004ec:	89 44 24 04          	mov    %eax,0x4(%esp)
c01004f0:	8b 45 10             	mov    0x10(%ebp),%eax
c01004f3:	89 04 24             	mov    %eax,(%esp)
c01004f6:	e8 9f fd ff ff       	call   c010029a <vcprintf>
    cprintf("\n");
c01004fb:	c7 04 24 26 c2 10 c0 	movl   $0xc010c226,(%esp)
c0100502:	e8 ca fd ff ff       	call   c01002d1 <cprintf>
    va_end(ap);
}
c0100507:	90                   	nop
c0100508:	c9                   	leave  
c0100509:	c3                   	ret    

c010050a <is_kernel_panic>:

bool
is_kernel_panic(void) {
c010050a:	f3 0f 1e fb          	endbr32 
c010050e:	55                   	push   %ebp
c010050f:	89 e5                	mov    %esp,%ebp
    return is_panic;
c0100511:	a1 20 14 1b c0       	mov    0xc01b1420,%eax
}
c0100516:	5d                   	pop    %ebp
c0100517:	c3                   	ret    

c0100518 <stab_binsearch>:
 *      stab_binsearch(stabs, &left, &right, N_SO, 0xf0100184);
 * will exit setting left = 118, right = 554.
 * */
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
c0100518:	f3 0f 1e fb          	endbr32 
c010051c:	55                   	push   %ebp
c010051d:	89 e5                	mov    %esp,%ebp
c010051f:	83 ec 20             	sub    $0x20,%esp
    int l = *region_left, r = *region_right, any_matches = 0;
c0100522:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100525:	8b 00                	mov    (%eax),%eax
c0100527:	89 45 fc             	mov    %eax,-0x4(%ebp)
c010052a:	8b 45 10             	mov    0x10(%ebp),%eax
c010052d:	8b 00                	mov    (%eax),%eax
c010052f:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0100532:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

    while (l <= r) {
c0100539:	e9 ca 00 00 00       	jmp    c0100608 <stab_binsearch+0xf0>
        int true_m = (l + r) / 2, m = true_m;
c010053e:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100541:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100544:	01 d0                	add    %edx,%eax
c0100546:	89 c2                	mov    %eax,%edx
c0100548:	c1 ea 1f             	shr    $0x1f,%edx
c010054b:	01 d0                	add    %edx,%eax
c010054d:	d1 f8                	sar    %eax
c010054f:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100552:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100555:	89 45 f0             	mov    %eax,-0x10(%ebp)

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c0100558:	eb 03                	jmp    c010055d <stab_binsearch+0x45>
            m --;
c010055a:	ff 4d f0             	decl   -0x10(%ebp)
        while (m >= l && stabs[m].n_type != type) {
c010055d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100560:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100563:	7c 1f                	jl     c0100584 <stab_binsearch+0x6c>
c0100565:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100568:	89 d0                	mov    %edx,%eax
c010056a:	01 c0                	add    %eax,%eax
c010056c:	01 d0                	add    %edx,%eax
c010056e:	c1 e0 02             	shl    $0x2,%eax
c0100571:	89 c2                	mov    %eax,%edx
c0100573:	8b 45 08             	mov    0x8(%ebp),%eax
c0100576:	01 d0                	add    %edx,%eax
c0100578:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c010057c:	0f b6 c0             	movzbl %al,%eax
c010057f:	39 45 14             	cmp    %eax,0x14(%ebp)
c0100582:	75 d6                	jne    c010055a <stab_binsearch+0x42>
        }
        if (m < l) {    // no match in [l, m]
c0100584:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100587:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c010058a:	7d 09                	jge    c0100595 <stab_binsearch+0x7d>
            l = true_m + 1;
c010058c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010058f:	40                   	inc    %eax
c0100590:	89 45 fc             	mov    %eax,-0x4(%ebp)
            continue;
c0100593:	eb 73                	jmp    c0100608 <stab_binsearch+0xf0>
        }

        // actual binary search
        any_matches = 1;
c0100595:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
        if (stabs[m].n_value < addr) {
c010059c:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010059f:	89 d0                	mov    %edx,%eax
c01005a1:	01 c0                	add    %eax,%eax
c01005a3:	01 d0                	add    %edx,%eax
c01005a5:	c1 e0 02             	shl    $0x2,%eax
c01005a8:	89 c2                	mov    %eax,%edx
c01005aa:	8b 45 08             	mov    0x8(%ebp),%eax
c01005ad:	01 d0                	add    %edx,%eax
c01005af:	8b 40 08             	mov    0x8(%eax),%eax
c01005b2:	39 45 18             	cmp    %eax,0x18(%ebp)
c01005b5:	76 11                	jbe    c01005c8 <stab_binsearch+0xb0>
            *region_left = m;
c01005b7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01005ba:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005bd:	89 10                	mov    %edx,(%eax)
            l = true_m + 1;
c01005bf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01005c2:	40                   	inc    %eax
c01005c3:	89 45 fc             	mov    %eax,-0x4(%ebp)
c01005c6:	eb 40                	jmp    c0100608 <stab_binsearch+0xf0>
        } else if (stabs[m].n_value > addr) {
c01005c8:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005cb:	89 d0                	mov    %edx,%eax
c01005cd:	01 c0                	add    %eax,%eax
c01005cf:	01 d0                	add    %edx,%eax
c01005d1:	c1 e0 02             	shl    $0x2,%eax
c01005d4:	89 c2                	mov    %eax,%edx
c01005d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01005d9:	01 d0                	add    %edx,%eax
c01005db:	8b 40 08             	mov    0x8(%eax),%eax
c01005de:	39 45 18             	cmp    %eax,0x18(%ebp)
c01005e1:	73 14                	jae    c01005f7 <stab_binsearch+0xdf>
            *region_right = m - 1;
c01005e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005e6:	8d 50 ff             	lea    -0x1(%eax),%edx
c01005e9:	8b 45 10             	mov    0x10(%ebp),%eax
c01005ec:	89 10                	mov    %edx,(%eax)
            r = m - 1;
c01005ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005f1:	48                   	dec    %eax
c01005f2:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01005f5:	eb 11                	jmp    c0100608 <stab_binsearch+0xf0>
        } else {
            // exact match for 'addr', but continue loop to find
            // *region_right
            *region_left = m;
c01005f7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01005fa:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005fd:	89 10                	mov    %edx,(%eax)
            l = m;
c01005ff:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100602:	89 45 fc             	mov    %eax,-0x4(%ebp)
            addr ++;
c0100605:	ff 45 18             	incl   0x18(%ebp)
    while (l <= r) {
c0100608:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010060b:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c010060e:	0f 8e 2a ff ff ff    	jle    c010053e <stab_binsearch+0x26>
        }
    }

    if (!any_matches) {
c0100614:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100618:	75 0f                	jne    c0100629 <stab_binsearch+0x111>
        *region_right = *region_left - 1;
c010061a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010061d:	8b 00                	mov    (%eax),%eax
c010061f:	8d 50 ff             	lea    -0x1(%eax),%edx
c0100622:	8b 45 10             	mov    0x10(%ebp),%eax
c0100625:	89 10                	mov    %edx,(%eax)
        l = *region_right;
        for (; l > *region_left && stabs[l].n_type != type; l --)
            /* do nothing */;
        *region_left = l;
    }
}
c0100627:	eb 3e                	jmp    c0100667 <stab_binsearch+0x14f>
        l = *region_right;
c0100629:	8b 45 10             	mov    0x10(%ebp),%eax
c010062c:	8b 00                	mov    (%eax),%eax
c010062e:	89 45 fc             	mov    %eax,-0x4(%ebp)
        for (; l > *region_left && stabs[l].n_type != type; l --)
c0100631:	eb 03                	jmp    c0100636 <stab_binsearch+0x11e>
c0100633:	ff 4d fc             	decl   -0x4(%ebp)
c0100636:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100639:	8b 00                	mov    (%eax),%eax
c010063b:	39 45 fc             	cmp    %eax,-0x4(%ebp)
c010063e:	7e 1f                	jle    c010065f <stab_binsearch+0x147>
c0100640:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100643:	89 d0                	mov    %edx,%eax
c0100645:	01 c0                	add    %eax,%eax
c0100647:	01 d0                	add    %edx,%eax
c0100649:	c1 e0 02             	shl    $0x2,%eax
c010064c:	89 c2                	mov    %eax,%edx
c010064e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100651:	01 d0                	add    %edx,%eax
c0100653:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100657:	0f b6 c0             	movzbl %al,%eax
c010065a:	39 45 14             	cmp    %eax,0x14(%ebp)
c010065d:	75 d4                	jne    c0100633 <stab_binsearch+0x11b>
        *region_left = l;
c010065f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100662:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100665:	89 10                	mov    %edx,(%eax)
}
c0100667:	90                   	nop
c0100668:	c9                   	leave  
c0100669:	c3                   	ret    

c010066a <debuginfo_eip>:
 * the specified instruction address, @addr.  Returns 0 if information
 * was found, and negative if not.  But even if it returns negative it
 * has stored some information into '*info'.
 * */
int
debuginfo_eip(uintptr_t addr, struct eipdebuginfo *info) {
c010066a:	f3 0f 1e fb          	endbr32 
c010066e:	55                   	push   %ebp
c010066f:	89 e5                	mov    %esp,%ebp
c0100671:	83 ec 58             	sub    $0x58,%esp
    const struct stab *stabs, *stab_end;
    const char *stabstr, *stabstr_end;

    info->eip_file = "<unknown>";
c0100674:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100677:	c7 00 58 c2 10 c0    	movl   $0xc010c258,(%eax)
    info->eip_line = 0;
c010067d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100680:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    info->eip_fn_name = "<unknown>";
c0100687:	8b 45 0c             	mov    0xc(%ebp),%eax
c010068a:	c7 40 08 58 c2 10 c0 	movl   $0xc010c258,0x8(%eax)
    info->eip_fn_namelen = 9;
c0100691:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100694:	c7 40 0c 09 00 00 00 	movl   $0x9,0xc(%eax)
    info->eip_fn_addr = addr;
c010069b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010069e:	8b 55 08             	mov    0x8(%ebp),%edx
c01006a1:	89 50 10             	mov    %edx,0x10(%eax)
    info->eip_fn_narg = 0;
c01006a4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006a7:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)

    // find the relevant set of stabs
    if (addr >= KERNBASE) {
c01006ae:	81 7d 08 ff ff ff bf 	cmpl   $0xbfffffff,0x8(%ebp)
c01006b5:	76 21                	jbe    c01006d8 <debuginfo_eip+0x6e>
        stabs = __STAB_BEGIN__;
c01006b7:	c7 45 f4 80 e9 10 c0 	movl   $0xc010e980,-0xc(%ebp)
        stab_end = __STAB_END__;
c01006be:	c7 45 f0 40 6d 12 c0 	movl   $0xc0126d40,-0x10(%ebp)
        stabstr = __STABSTR_BEGIN__;
c01006c5:	c7 45 ec 41 6d 12 c0 	movl   $0xc0126d41,-0x14(%ebp)
        stabstr_end = __STABSTR_END__;
c01006cc:	c7 45 e8 1a bb 12 c0 	movl   $0xc012bb1a,-0x18(%ebp)
c01006d3:	e9 e6 00 00 00       	jmp    c01007be <debuginfo_eip+0x154>
    }
    else {
        // user-program linker script, tools/user.ld puts the information about the
        // program's stabs (included __STAB_BEGIN__, __STAB_END__, __STABSTR_BEGIN__,
        // and __STABSTR_END__) in a structure located at virtual address USTAB.
        const struct userstabdata *usd = (struct userstabdata *)USTAB;
c01006d8:	c7 45 e4 00 00 20 00 	movl   $0x200000,-0x1c(%ebp)

        // make sure that debugger (current process) can access this memory
        struct mm_struct *mm;
        if (current == NULL || (mm = current->mm) == NULL) {
c01006df:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c01006e4:	85 c0                	test   %eax,%eax
c01006e6:	74 11                	je     c01006f9 <debuginfo_eip+0x8f>
c01006e8:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c01006ed:	8b 40 18             	mov    0x18(%eax),%eax
c01006f0:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01006f3:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c01006f7:	75 0a                	jne    c0100703 <debuginfo_eip+0x99>
            return -1;
c01006f9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01006fe:	e9 83 03 00 00       	jmp    c0100a86 <debuginfo_eip+0x41c>
        }
        if (!user_mem_check(mm, (uintptr_t)usd, sizeof(struct userstabdata), 0)) {
c0100703:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100706:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010070d:	00 
c010070e:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c0100715:	00 
c0100716:	89 44 24 04          	mov    %eax,0x4(%esp)
c010071a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010071d:	89 04 24             	mov    %eax,(%esp)
c0100720:	e8 9d 64 00 00       	call   c0106bc2 <user_mem_check>
c0100725:	85 c0                	test   %eax,%eax
c0100727:	75 0a                	jne    c0100733 <debuginfo_eip+0xc9>
            return -1;
c0100729:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c010072e:	e9 53 03 00 00       	jmp    c0100a86 <debuginfo_eip+0x41c>
        }

        stabs = usd->stabs;
c0100733:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100736:	8b 00                	mov    (%eax),%eax
c0100738:	89 45 f4             	mov    %eax,-0xc(%ebp)
        stab_end = usd->stab_end;
c010073b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010073e:	8b 40 04             	mov    0x4(%eax),%eax
c0100741:	89 45 f0             	mov    %eax,-0x10(%ebp)
        stabstr = usd->stabstr;
c0100744:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100747:	8b 40 08             	mov    0x8(%eax),%eax
c010074a:	89 45 ec             	mov    %eax,-0x14(%ebp)
        stabstr_end = usd->stabstr_end;
c010074d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100750:	8b 40 0c             	mov    0xc(%eax),%eax
c0100753:	89 45 e8             	mov    %eax,-0x18(%ebp)

        // make sure the STABS and string table memory is valid
        if (!user_mem_check(mm, (uintptr_t)stabs, (uintptr_t)stab_end - (uintptr_t)stabs, 0)) {
c0100756:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100759:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010075c:	29 c2                	sub    %eax,%edx
c010075e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100761:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0100768:	00 
c0100769:	89 54 24 08          	mov    %edx,0x8(%esp)
c010076d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100771:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100774:	89 04 24             	mov    %eax,(%esp)
c0100777:	e8 46 64 00 00       	call   c0106bc2 <user_mem_check>
c010077c:	85 c0                	test   %eax,%eax
c010077e:	75 0a                	jne    c010078a <debuginfo_eip+0x120>
            return -1;
c0100780:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100785:	e9 fc 02 00 00       	jmp    c0100a86 <debuginfo_eip+0x41c>
        }
        if (!user_mem_check(mm, (uintptr_t)stabstr, stabstr_end - stabstr, 0)) {
c010078a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010078d:	2b 45 ec             	sub    -0x14(%ebp),%eax
c0100790:	89 c2                	mov    %eax,%edx
c0100792:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100795:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010079c:	00 
c010079d:	89 54 24 08          	mov    %edx,0x8(%esp)
c01007a1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01007a5:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01007a8:	89 04 24             	mov    %eax,(%esp)
c01007ab:	e8 12 64 00 00       	call   c0106bc2 <user_mem_check>
c01007b0:	85 c0                	test   %eax,%eax
c01007b2:	75 0a                	jne    c01007be <debuginfo_eip+0x154>
            return -1;
c01007b4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01007b9:	e9 c8 02 00 00       	jmp    c0100a86 <debuginfo_eip+0x41c>
        }
    }

    // String table validity checks
    if (stabstr_end <= stabstr || stabstr_end[-1] != 0) {
c01007be:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01007c1:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01007c4:	76 0b                	jbe    c01007d1 <debuginfo_eip+0x167>
c01007c6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01007c9:	48                   	dec    %eax
c01007ca:	0f b6 00             	movzbl (%eax),%eax
c01007cd:	84 c0                	test   %al,%al
c01007cf:	74 0a                	je     c01007db <debuginfo_eip+0x171>
        return -1;
c01007d1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01007d6:	e9 ab 02 00 00       	jmp    c0100a86 <debuginfo_eip+0x41c>
    // 'eip'.  First, we find the basic source file containing 'eip'.
    // Then, we look in that source file for the function.  Then we look
    // for the line number.

    // Search the entire set of stabs for the source file (type N_SO).
    int lfile = 0, rfile = (stab_end - stabs) - 1;
c01007db:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c01007e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01007e5:	2b 45 f4             	sub    -0xc(%ebp),%eax
c01007e8:	c1 f8 02             	sar    $0x2,%eax
c01007eb:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
c01007f1:	48                   	dec    %eax
c01007f2:	89 45 d8             	mov    %eax,-0x28(%ebp)
    stab_binsearch(stabs, &lfile, &rfile, N_SO, addr);
c01007f5:	8b 45 08             	mov    0x8(%ebp),%eax
c01007f8:	89 44 24 10          	mov    %eax,0x10(%esp)
c01007fc:	c7 44 24 0c 64 00 00 	movl   $0x64,0xc(%esp)
c0100803:	00 
c0100804:	8d 45 d8             	lea    -0x28(%ebp),%eax
c0100807:	89 44 24 08          	mov    %eax,0x8(%esp)
c010080b:	8d 45 dc             	lea    -0x24(%ebp),%eax
c010080e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100812:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100815:	89 04 24             	mov    %eax,(%esp)
c0100818:	e8 fb fc ff ff       	call   c0100518 <stab_binsearch>
    if (lfile == 0)
c010081d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100820:	85 c0                	test   %eax,%eax
c0100822:	75 0a                	jne    c010082e <debuginfo_eip+0x1c4>
        return -1;
c0100824:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100829:	e9 58 02 00 00       	jmp    c0100a86 <debuginfo_eip+0x41c>

    // Search within that file's stabs for the function definition
    // (N_FUN).
    int lfun = lfile, rfun = rfile;
c010082e:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100831:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c0100834:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100837:	89 45 d0             	mov    %eax,-0x30(%ebp)
    int lline, rline;
    stab_binsearch(stabs, &lfun, &rfun, N_FUN, addr);
c010083a:	8b 45 08             	mov    0x8(%ebp),%eax
c010083d:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100841:	c7 44 24 0c 24 00 00 	movl   $0x24,0xc(%esp)
c0100848:	00 
c0100849:	8d 45 d0             	lea    -0x30(%ebp),%eax
c010084c:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100850:	8d 45 d4             	lea    -0x2c(%ebp),%eax
c0100853:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100857:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010085a:	89 04 24             	mov    %eax,(%esp)
c010085d:	e8 b6 fc ff ff       	call   c0100518 <stab_binsearch>

    if (lfun <= rfun) {
c0100862:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100865:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100868:	39 c2                	cmp    %eax,%edx
c010086a:	7f 78                	jg     c01008e4 <debuginfo_eip+0x27a>
        // stabs[lfun] points to the function name
        // in the string table, but check bounds just in case.
        if (stabs[lfun].n_strx < stabstr_end - stabstr) {
c010086c:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010086f:	89 c2                	mov    %eax,%edx
c0100871:	89 d0                	mov    %edx,%eax
c0100873:	01 c0                	add    %eax,%eax
c0100875:	01 d0                	add    %edx,%eax
c0100877:	c1 e0 02             	shl    $0x2,%eax
c010087a:	89 c2                	mov    %eax,%edx
c010087c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010087f:	01 d0                	add    %edx,%eax
c0100881:	8b 10                	mov    (%eax),%edx
c0100883:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100886:	2b 45 ec             	sub    -0x14(%ebp),%eax
c0100889:	39 c2                	cmp    %eax,%edx
c010088b:	73 22                	jae    c01008af <debuginfo_eip+0x245>
            info->eip_fn_name = stabstr + stabs[lfun].n_strx;
c010088d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100890:	89 c2                	mov    %eax,%edx
c0100892:	89 d0                	mov    %edx,%eax
c0100894:	01 c0                	add    %eax,%eax
c0100896:	01 d0                	add    %edx,%eax
c0100898:	c1 e0 02             	shl    $0x2,%eax
c010089b:	89 c2                	mov    %eax,%edx
c010089d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008a0:	01 d0                	add    %edx,%eax
c01008a2:	8b 10                	mov    (%eax),%edx
c01008a4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01008a7:	01 c2                	add    %eax,%edx
c01008a9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01008ac:	89 50 08             	mov    %edx,0x8(%eax)
        }
        info->eip_fn_addr = stabs[lfun].n_value;
c01008af:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008b2:	89 c2                	mov    %eax,%edx
c01008b4:	89 d0                	mov    %edx,%eax
c01008b6:	01 c0                	add    %eax,%eax
c01008b8:	01 d0                	add    %edx,%eax
c01008ba:	c1 e0 02             	shl    $0x2,%eax
c01008bd:	89 c2                	mov    %eax,%edx
c01008bf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008c2:	01 d0                	add    %edx,%eax
c01008c4:	8b 50 08             	mov    0x8(%eax),%edx
c01008c7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01008ca:	89 50 10             	mov    %edx,0x10(%eax)
        addr -= info->eip_fn_addr;
c01008cd:	8b 45 0c             	mov    0xc(%ebp),%eax
c01008d0:	8b 40 10             	mov    0x10(%eax),%eax
c01008d3:	29 45 08             	sub    %eax,0x8(%ebp)
        // Search within the function definition for the line number.
        lline = lfun;
c01008d6:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008d9:	89 45 cc             	mov    %eax,-0x34(%ebp)
        rline = rfun;
c01008dc:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01008df:	89 45 c8             	mov    %eax,-0x38(%ebp)
c01008e2:	eb 15                	jmp    c01008f9 <debuginfo_eip+0x28f>
    } else {
        // Couldn't find function stab!  Maybe we're in an assembly
        // file.  Search the whole file for the line number.
        info->eip_fn_addr = addr;
c01008e4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01008e7:	8b 55 08             	mov    0x8(%ebp),%edx
c01008ea:	89 50 10             	mov    %edx,0x10(%eax)
        lline = lfile;
c01008ed:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01008f0:	89 45 cc             	mov    %eax,-0x34(%ebp)
        rline = rfile;
c01008f3:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01008f6:	89 45 c8             	mov    %eax,-0x38(%ebp)
    }
    info->eip_fn_namelen = strfind(info->eip_fn_name, ':') - info->eip_fn_name;
c01008f9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01008fc:	8b 40 08             	mov    0x8(%eax),%eax
c01008ff:	c7 44 24 04 3a 00 00 	movl   $0x3a,0x4(%esp)
c0100906:	00 
c0100907:	89 04 24             	mov    %eax,(%esp)
c010090a:	e8 92 ad 00 00       	call   c010b6a1 <strfind>
c010090f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0100912:	8b 52 08             	mov    0x8(%edx),%edx
c0100915:	29 d0                	sub    %edx,%eax
c0100917:	89 c2                	mov    %eax,%edx
c0100919:	8b 45 0c             	mov    0xc(%ebp),%eax
c010091c:	89 50 0c             	mov    %edx,0xc(%eax)

    // Search within [lline, rline] for the line number stab.
    // If found, set info->eip_line to the right line number.
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
c010091f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100922:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100926:	c7 44 24 0c 44 00 00 	movl   $0x44,0xc(%esp)
c010092d:	00 
c010092e:	8d 45 c8             	lea    -0x38(%ebp),%eax
c0100931:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100935:	8d 45 cc             	lea    -0x34(%ebp),%eax
c0100938:	89 44 24 04          	mov    %eax,0x4(%esp)
c010093c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010093f:	89 04 24             	mov    %eax,(%esp)
c0100942:	e8 d1 fb ff ff       	call   c0100518 <stab_binsearch>
    if (lline <= rline) {
c0100947:	8b 55 cc             	mov    -0x34(%ebp),%edx
c010094a:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010094d:	39 c2                	cmp    %eax,%edx
c010094f:	7f 23                	jg     c0100974 <debuginfo_eip+0x30a>
        info->eip_line = stabs[rline].n_desc;
c0100951:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0100954:	89 c2                	mov    %eax,%edx
c0100956:	89 d0                	mov    %edx,%eax
c0100958:	01 c0                	add    %eax,%eax
c010095a:	01 d0                	add    %edx,%eax
c010095c:	c1 e0 02             	shl    $0x2,%eax
c010095f:	89 c2                	mov    %eax,%edx
c0100961:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100964:	01 d0                	add    %edx,%eax
c0100966:	0f b7 40 06          	movzwl 0x6(%eax),%eax
c010096a:	89 c2                	mov    %eax,%edx
c010096c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010096f:	89 50 04             	mov    %edx,0x4(%eax)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0100972:	eb 11                	jmp    c0100985 <debuginfo_eip+0x31b>
        return -1;
c0100974:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100979:	e9 08 01 00 00       	jmp    c0100a86 <debuginfo_eip+0x41c>
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
        lline --;
c010097e:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0100981:	48                   	dec    %eax
c0100982:	89 45 cc             	mov    %eax,-0x34(%ebp)
    while (lline >= lfile
c0100985:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0100988:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010098b:	39 c2                	cmp    %eax,%edx
c010098d:	7c 56                	jl     c01009e5 <debuginfo_eip+0x37b>
           && stabs[lline].n_type != N_SOL
c010098f:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0100992:	89 c2                	mov    %eax,%edx
c0100994:	89 d0                	mov    %edx,%eax
c0100996:	01 c0                	add    %eax,%eax
c0100998:	01 d0                	add    %edx,%eax
c010099a:	c1 e0 02             	shl    $0x2,%eax
c010099d:	89 c2                	mov    %eax,%edx
c010099f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01009a2:	01 d0                	add    %edx,%eax
c01009a4:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01009a8:	3c 84                	cmp    $0x84,%al
c01009aa:	74 39                	je     c01009e5 <debuginfo_eip+0x37b>
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c01009ac:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01009af:	89 c2                	mov    %eax,%edx
c01009b1:	89 d0                	mov    %edx,%eax
c01009b3:	01 c0                	add    %eax,%eax
c01009b5:	01 d0                	add    %edx,%eax
c01009b7:	c1 e0 02             	shl    $0x2,%eax
c01009ba:	89 c2                	mov    %eax,%edx
c01009bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01009bf:	01 d0                	add    %edx,%eax
c01009c1:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01009c5:	3c 64                	cmp    $0x64,%al
c01009c7:	75 b5                	jne    c010097e <debuginfo_eip+0x314>
c01009c9:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01009cc:	89 c2                	mov    %eax,%edx
c01009ce:	89 d0                	mov    %edx,%eax
c01009d0:	01 c0                	add    %eax,%eax
c01009d2:	01 d0                	add    %edx,%eax
c01009d4:	c1 e0 02             	shl    $0x2,%eax
c01009d7:	89 c2                	mov    %eax,%edx
c01009d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01009dc:	01 d0                	add    %edx,%eax
c01009de:	8b 40 08             	mov    0x8(%eax),%eax
c01009e1:	85 c0                	test   %eax,%eax
c01009e3:	74 99                	je     c010097e <debuginfo_eip+0x314>
    }
    if (lline >= lfile && stabs[lline].n_strx < stabstr_end - stabstr) {
c01009e5:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01009e8:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01009eb:	39 c2                	cmp    %eax,%edx
c01009ed:	7c 42                	jl     c0100a31 <debuginfo_eip+0x3c7>
c01009ef:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01009f2:	89 c2                	mov    %eax,%edx
c01009f4:	89 d0                	mov    %edx,%eax
c01009f6:	01 c0                	add    %eax,%eax
c01009f8:	01 d0                	add    %edx,%eax
c01009fa:	c1 e0 02             	shl    $0x2,%eax
c01009fd:	89 c2                	mov    %eax,%edx
c01009ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a02:	01 d0                	add    %edx,%eax
c0100a04:	8b 10                	mov    (%eax),%edx
c0100a06:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a09:	2b 45 ec             	sub    -0x14(%ebp),%eax
c0100a0c:	39 c2                	cmp    %eax,%edx
c0100a0e:	73 21                	jae    c0100a31 <debuginfo_eip+0x3c7>
        info->eip_file = stabstr + stabs[lline].n_strx;
c0100a10:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0100a13:	89 c2                	mov    %eax,%edx
c0100a15:	89 d0                	mov    %edx,%eax
c0100a17:	01 c0                	add    %eax,%eax
c0100a19:	01 d0                	add    %edx,%eax
c0100a1b:	c1 e0 02             	shl    $0x2,%eax
c0100a1e:	89 c2                	mov    %eax,%edx
c0100a20:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a23:	01 d0                	add    %edx,%eax
c0100a25:	8b 10                	mov    (%eax),%edx
c0100a27:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100a2a:	01 c2                	add    %eax,%edx
c0100a2c:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100a2f:	89 10                	mov    %edx,(%eax)
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
c0100a31:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100a34:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100a37:	39 c2                	cmp    %eax,%edx
c0100a39:	7d 46                	jge    c0100a81 <debuginfo_eip+0x417>
        for (lline = lfun + 1;
c0100a3b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100a3e:	40                   	inc    %eax
c0100a3f:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0100a42:	eb 16                	jmp    c0100a5a <debuginfo_eip+0x3f0>
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
            info->eip_fn_narg ++;
c0100a44:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100a47:	8b 40 14             	mov    0x14(%eax),%eax
c0100a4a:	8d 50 01             	lea    0x1(%eax),%edx
c0100a4d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100a50:	89 50 14             	mov    %edx,0x14(%eax)
             lline ++) {
c0100a53:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0100a56:	40                   	inc    %eax
c0100a57:	89 45 cc             	mov    %eax,-0x34(%ebp)
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100a5a:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0100a5d:	8b 45 d0             	mov    -0x30(%ebp),%eax
        for (lline = lfun + 1;
c0100a60:	39 c2                	cmp    %eax,%edx
c0100a62:	7d 1d                	jge    c0100a81 <debuginfo_eip+0x417>
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100a64:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0100a67:	89 c2                	mov    %eax,%edx
c0100a69:	89 d0                	mov    %edx,%eax
c0100a6b:	01 c0                	add    %eax,%eax
c0100a6d:	01 d0                	add    %edx,%eax
c0100a6f:	c1 e0 02             	shl    $0x2,%eax
c0100a72:	89 c2                	mov    %eax,%edx
c0100a74:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a77:	01 d0                	add    %edx,%eax
c0100a79:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100a7d:	3c a0                	cmp    $0xa0,%al
c0100a7f:	74 c3                	je     c0100a44 <debuginfo_eip+0x3da>
        }
    }
    return 0;
c0100a81:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100a86:	c9                   	leave  
c0100a87:	c3                   	ret    

c0100a88 <print_kerninfo>:
 * print_kerninfo - print the information about kernel, including the location
 * of kernel entry, the start addresses of data and text segements, the start
 * address of free memory and how many memory that kernel has used.
 * */
void
print_kerninfo(void) {
c0100a88:	f3 0f 1e fb          	endbr32 
c0100a8c:	55                   	push   %ebp
c0100a8d:	89 e5                	mov    %esp,%ebp
c0100a8f:	83 ec 18             	sub    $0x18,%esp
    extern char etext[], edata[], end[], kern_init[];
    cprintf("Special kernel symbols:\n");
c0100a92:	c7 04 24 62 c2 10 c0 	movl   $0xc010c262,(%esp)
c0100a99:	e8 33 f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("  entry  0x%08x (phys)\n", kern_init);
c0100a9e:	c7 44 24 04 36 00 10 	movl   $0xc0100036,0x4(%esp)
c0100aa5:	c0 
c0100aa6:	c7 04 24 7b c2 10 c0 	movl   $0xc010c27b,(%esp)
c0100aad:	e8 1f f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("  etext  0x%08x (phys)\n", etext);
c0100ab2:	c7 44 24 04 5a c1 10 	movl   $0xc010c15a,0x4(%esp)
c0100ab9:	c0 
c0100aba:	c7 04 24 93 c2 10 c0 	movl   $0xc010c293,(%esp)
c0100ac1:	e8 0b f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("  edata  0x%08x (phys)\n", edata);
c0100ac6:	c7 44 24 04 00 10 1b 	movl   $0xc01b1000,0x4(%esp)
c0100acd:	c0 
c0100ace:	c7 04 24 ab c2 10 c0 	movl   $0xc010c2ab,(%esp)
c0100ad5:	e8 f7 f7 ff ff       	call   c01002d1 <cprintf>
    cprintf("  end    0x%08x (phys)\n", end);
c0100ada:	c7 44 24 04 58 41 1b 	movl   $0xc01b4158,0x4(%esp)
c0100ae1:	c0 
c0100ae2:	c7 04 24 c3 c2 10 c0 	movl   $0xc010c2c3,(%esp)
c0100ae9:	e8 e3 f7 ff ff       	call   c01002d1 <cprintf>
    cprintf("Kernel executable memory footprint: %dKB\n", (end - kern_init + 1023)/1024);
c0100aee:	b8 58 41 1b c0       	mov    $0xc01b4158,%eax
c0100af3:	2d 36 00 10 c0       	sub    $0xc0100036,%eax
c0100af8:	05 ff 03 00 00       	add    $0x3ff,%eax
c0100afd:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c0100b03:	85 c0                	test   %eax,%eax
c0100b05:	0f 48 c2             	cmovs  %edx,%eax
c0100b08:	c1 f8 0a             	sar    $0xa,%eax
c0100b0b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b0f:	c7 04 24 dc c2 10 c0 	movl   $0xc010c2dc,(%esp)
c0100b16:	e8 b6 f7 ff ff       	call   c01002d1 <cprintf>
}
c0100b1b:	90                   	nop
c0100b1c:	c9                   	leave  
c0100b1d:	c3                   	ret    

c0100b1e <print_debuginfo>:
/* *
 * print_debuginfo - read and print the stat information for the address @eip,
 * and info.eip_fn_addr should be the first address of the related function.
 * */
void
print_debuginfo(uintptr_t eip) {
c0100b1e:	f3 0f 1e fb          	endbr32 
c0100b22:	55                   	push   %ebp
c0100b23:	89 e5                	mov    %esp,%ebp
c0100b25:	81 ec 48 01 00 00    	sub    $0x148,%esp
    struct eipdebuginfo info;
    if (debuginfo_eip(eip, &info) != 0) {
c0100b2b:	8d 45 dc             	lea    -0x24(%ebp),%eax
c0100b2e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b32:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b35:	89 04 24             	mov    %eax,(%esp)
c0100b38:	e8 2d fb ff ff       	call   c010066a <debuginfo_eip>
c0100b3d:	85 c0                	test   %eax,%eax
c0100b3f:	74 15                	je     c0100b56 <print_debuginfo+0x38>
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
c0100b41:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b44:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b48:	c7 04 24 06 c3 10 c0 	movl   $0xc010c306,(%esp)
c0100b4f:	e8 7d f7 ff ff       	call   c01002d1 <cprintf>
        }
        fnname[j] = '\0';
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
                fnname, eip - info.eip_fn_addr);
    }
}
c0100b54:	eb 6c                	jmp    c0100bc2 <print_debuginfo+0xa4>
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100b56:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100b5d:	eb 1b                	jmp    c0100b7a <print_debuginfo+0x5c>
            fnname[j] = info.eip_fn_name[j];
c0100b5f:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0100b62:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b65:	01 d0                	add    %edx,%eax
c0100b67:	0f b6 10             	movzbl (%eax),%edx
c0100b6a:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0100b70:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b73:	01 c8                	add    %ecx,%eax
c0100b75:	88 10                	mov    %dl,(%eax)
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100b77:	ff 45 f4             	incl   -0xc(%ebp)
c0100b7a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100b7d:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0100b80:	7c dd                	jl     c0100b5f <print_debuginfo+0x41>
        fnname[j] = '\0';
c0100b82:	8d 95 dc fe ff ff    	lea    -0x124(%ebp),%edx
c0100b88:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b8b:	01 d0                	add    %edx,%eax
c0100b8d:	c6 00 00             	movb   $0x0,(%eax)
                fnname, eip - info.eip_fn_addr);
c0100b90:	8b 45 ec             	mov    -0x14(%ebp),%eax
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
c0100b93:	8b 55 08             	mov    0x8(%ebp),%edx
c0100b96:	89 d1                	mov    %edx,%ecx
c0100b98:	29 c1                	sub    %eax,%ecx
c0100b9a:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100b9d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100ba0:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0100ba4:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0100baa:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0100bae:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100bb2:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100bb6:	c7 04 24 22 c3 10 c0 	movl   $0xc010c322,(%esp)
c0100bbd:	e8 0f f7 ff ff       	call   c01002d1 <cprintf>
}
c0100bc2:	90                   	nop
c0100bc3:	c9                   	leave  
c0100bc4:	c3                   	ret    

c0100bc5 <read_eip>:

static __noinline uint32_t
read_eip(void) {
c0100bc5:	f3 0f 1e fb          	endbr32 
c0100bc9:	55                   	push   %ebp
c0100bca:	89 e5                	mov    %esp,%ebp
c0100bcc:	83 ec 10             	sub    $0x10,%esp
    uint32_t eip;
    asm volatile("movl 4(%%ebp), %0" : "=r" (eip));
c0100bcf:	8b 45 04             	mov    0x4(%ebp),%eax
c0100bd2:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return eip;
c0100bd5:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0100bd8:	c9                   	leave  
c0100bd9:	c3                   	ret    

c0100bda <print_stackframe>:
 *
 * Note that, the length of ebp-chain is limited. In boot/bootasm.S, before jumping
 * to the kernel entry, the value of ebp has been set to zero, that's the boundary.
 * */
void
print_stackframe(void) {
c0100bda:	f3 0f 1e fb          	endbr32 
c0100bde:	55                   	push   %ebp
c0100bdf:	89 e5                	mov    %esp,%ebp
c0100be1:	83 ec 38             	sub    $0x38,%esp
}

static inline uint32_t
read_ebp(void) {
    uint32_t ebp;
    asm volatile ("movl %%ebp, %0" : "=r" (ebp));
c0100be4:	89 e8                	mov    %ebp,%eax
c0100be6:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return ebp;
c0100be9:	8b 45 e0             	mov    -0x20(%ebp),%eax
      *    (3.4) call print_debuginfo(eip-1) to print the C calling function name and line number, etc.
      *    (3.5) popup a calling stackframe
      *           NOTICE: the calling funciton's return addr eip  = ss:[ebp+4]
      *                   the calling funciton's ebp = ss:[ebp]
      */
	uint32_t ebp=read_ebp(),eip=read_eip();
c0100bec:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100bef:	e8 d1 ff ff ff       	call   c0100bc5 <read_eip>
c0100bf4:	89 45 f0             	mov    %eax,-0x10(%ebp)
	int i,j;
	for(i=0;ebp!=0&&i<STACKFRAME_DEPTH;i++)
c0100bf7:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0100bfe:	e9 84 00 00 00       	jmp    c0100c87 <print_stackframe+0xad>
	{cprintf("ebp:0x%08x eip:0x%08x args:",ebp,eip);
c0100c03:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100c06:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100c0a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c0d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c11:	c7 04 24 34 c3 10 c0 	movl   $0xc010c334,(%esp)
c0100c18:	e8 b4 f6 ff ff       	call   c01002d1 <cprintf>
	 uint32_t *args=(uint32_t *)ebp + 2;
c0100c1d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c20:	83 c0 08             	add    $0x8,%eax
c0100c23:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	 for(j=0;j<4;j++) cprintf("0x%08x ",args[j]);
c0100c26:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0100c2d:	eb 24                	jmp    c0100c53 <print_stackframe+0x79>
c0100c2f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100c32:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100c39:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100c3c:	01 d0                	add    %edx,%eax
c0100c3e:	8b 00                	mov    (%eax),%eax
c0100c40:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c44:	c7 04 24 50 c3 10 c0 	movl   $0xc010c350,(%esp)
c0100c4b:	e8 81 f6 ff ff       	call   c01002d1 <cprintf>
c0100c50:	ff 45 e8             	incl   -0x18(%ebp)
c0100c53:	83 7d e8 03          	cmpl   $0x3,-0x18(%ebp)
c0100c57:	7e d6                	jle    c0100c2f <print_stackframe+0x55>
	 cprintf("\n");
c0100c59:	c7 04 24 58 c3 10 c0 	movl   $0xc010c358,(%esp)
c0100c60:	e8 6c f6 ff ff       	call   c01002d1 <cprintf>
	 print_debuginfo(eip-1);
c0100c65:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100c68:	48                   	dec    %eax
c0100c69:	89 04 24             	mov    %eax,(%esp)
c0100c6c:	e8 ad fe ff ff       	call   c0100b1e <print_debuginfo>
	 eip=((uint32_t *)ebp)[1];
c0100c71:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c74:	83 c0 04             	add    $0x4,%eax
c0100c77:	8b 00                	mov    (%eax),%eax
c0100c79:	89 45 f0             	mov    %eax,-0x10(%ebp)
	 ebp=((uint32_t *)ebp)[0];
c0100c7c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c7f:	8b 00                	mov    (%eax),%eax
c0100c81:	89 45 f4             	mov    %eax,-0xc(%ebp)
	for(i=0;ebp!=0&&i<STACKFRAME_DEPTH;i++)
c0100c84:	ff 45 ec             	incl   -0x14(%ebp)
c0100c87:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100c8b:	74 0a                	je     c0100c97 <print_stackframe+0xbd>
c0100c8d:	83 7d ec 13          	cmpl   $0x13,-0x14(%ebp)
c0100c91:	0f 8e 6c ff ff ff    	jle    c0100c03 <print_stackframe+0x29>
	}
}
c0100c97:	90                   	nop
c0100c98:	c9                   	leave  
c0100c99:	c3                   	ret    

c0100c9a <parse>:
#define MAXARGS         16
#define WHITESPACE      " \t\n\r"

/* parse - parse the command buffer into whitespace-separated arguments */
static int
parse(char *buf, char **argv) {
c0100c9a:	f3 0f 1e fb          	endbr32 
c0100c9e:	55                   	push   %ebp
c0100c9f:	89 e5                	mov    %esp,%ebp
c0100ca1:	83 ec 28             	sub    $0x28,%esp
    int argc = 0;
c0100ca4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100cab:	eb 0c                	jmp    c0100cb9 <parse+0x1f>
            *buf ++ = '\0';
c0100cad:	8b 45 08             	mov    0x8(%ebp),%eax
c0100cb0:	8d 50 01             	lea    0x1(%eax),%edx
c0100cb3:	89 55 08             	mov    %edx,0x8(%ebp)
c0100cb6:	c6 00 00             	movb   $0x0,(%eax)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100cb9:	8b 45 08             	mov    0x8(%ebp),%eax
c0100cbc:	0f b6 00             	movzbl (%eax),%eax
c0100cbf:	84 c0                	test   %al,%al
c0100cc1:	74 1d                	je     c0100ce0 <parse+0x46>
c0100cc3:	8b 45 08             	mov    0x8(%ebp),%eax
c0100cc6:	0f b6 00             	movzbl (%eax),%eax
c0100cc9:	0f be c0             	movsbl %al,%eax
c0100ccc:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100cd0:	c7 04 24 dc c3 10 c0 	movl   $0xc010c3dc,(%esp)
c0100cd7:	e8 8f a9 00 00       	call   c010b66b <strchr>
c0100cdc:	85 c0                	test   %eax,%eax
c0100cde:	75 cd                	jne    c0100cad <parse+0x13>
        }
        if (*buf == '\0') {
c0100ce0:	8b 45 08             	mov    0x8(%ebp),%eax
c0100ce3:	0f b6 00             	movzbl (%eax),%eax
c0100ce6:	84 c0                	test   %al,%al
c0100ce8:	74 65                	je     c0100d4f <parse+0xb5>
            break;
        }

        // save and scan past next arg
        if (argc == MAXARGS - 1) {
c0100cea:	83 7d f4 0f          	cmpl   $0xf,-0xc(%ebp)
c0100cee:	75 14                	jne    c0100d04 <parse+0x6a>
            cprintf("Too many arguments (max %d).\n", MAXARGS);
c0100cf0:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
c0100cf7:	00 
c0100cf8:	c7 04 24 e1 c3 10 c0 	movl   $0xc010c3e1,(%esp)
c0100cff:	e8 cd f5 ff ff       	call   c01002d1 <cprintf>
        }
        argv[argc ++] = buf;
c0100d04:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100d07:	8d 50 01             	lea    0x1(%eax),%edx
c0100d0a:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0100d0d:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100d14:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100d17:	01 c2                	add    %eax,%edx
c0100d19:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d1c:	89 02                	mov    %eax,(%edx)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100d1e:	eb 03                	jmp    c0100d23 <parse+0x89>
            buf ++;
c0100d20:	ff 45 08             	incl   0x8(%ebp)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100d23:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d26:	0f b6 00             	movzbl (%eax),%eax
c0100d29:	84 c0                	test   %al,%al
c0100d2b:	74 8c                	je     c0100cb9 <parse+0x1f>
c0100d2d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d30:	0f b6 00             	movzbl (%eax),%eax
c0100d33:	0f be c0             	movsbl %al,%eax
c0100d36:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d3a:	c7 04 24 dc c3 10 c0 	movl   $0xc010c3dc,(%esp)
c0100d41:	e8 25 a9 00 00       	call   c010b66b <strchr>
c0100d46:	85 c0                	test   %eax,%eax
c0100d48:	74 d6                	je     c0100d20 <parse+0x86>
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100d4a:	e9 6a ff ff ff       	jmp    c0100cb9 <parse+0x1f>
            break;
c0100d4f:	90                   	nop
        }
    }
    return argc;
c0100d50:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100d53:	c9                   	leave  
c0100d54:	c3                   	ret    

c0100d55 <runcmd>:
/* *
 * runcmd - parse the input string, split it into separated arguments
 * and then lookup and invoke some related commands/
 * */
static int
runcmd(char *buf, struct trapframe *tf) {
c0100d55:	f3 0f 1e fb          	endbr32 
c0100d59:	55                   	push   %ebp
c0100d5a:	89 e5                	mov    %esp,%ebp
c0100d5c:	53                   	push   %ebx
c0100d5d:	83 ec 64             	sub    $0x64,%esp
    char *argv[MAXARGS];
    int argc = parse(buf, argv);
c0100d60:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100d63:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d67:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d6a:	89 04 24             	mov    %eax,(%esp)
c0100d6d:	e8 28 ff ff ff       	call   c0100c9a <parse>
c0100d72:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (argc == 0) {
c0100d75:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0100d79:	75 0a                	jne    c0100d85 <runcmd+0x30>
        return 0;
c0100d7b:	b8 00 00 00 00       	mov    $0x0,%eax
c0100d80:	e9 83 00 00 00       	jmp    c0100e08 <runcmd+0xb3>
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100d85:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100d8c:	eb 5a                	jmp    c0100de8 <runcmd+0x93>
        if (strcmp(commands[i].name, argv[0]) == 0) {
c0100d8e:	8b 4d b0             	mov    -0x50(%ebp),%ecx
c0100d91:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100d94:	89 d0                	mov    %edx,%eax
c0100d96:	01 c0                	add    %eax,%eax
c0100d98:	01 d0                	add    %edx,%eax
c0100d9a:	c1 e0 02             	shl    $0x2,%eax
c0100d9d:	05 00 e0 12 c0       	add    $0xc012e000,%eax
c0100da2:	8b 00                	mov    (%eax),%eax
c0100da4:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0100da8:	89 04 24             	mov    %eax,(%esp)
c0100dab:	e8 17 a8 00 00       	call   c010b5c7 <strcmp>
c0100db0:	85 c0                	test   %eax,%eax
c0100db2:	75 31                	jne    c0100de5 <runcmd+0x90>
            return commands[i].func(argc - 1, argv + 1, tf);
c0100db4:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100db7:	89 d0                	mov    %edx,%eax
c0100db9:	01 c0                	add    %eax,%eax
c0100dbb:	01 d0                	add    %edx,%eax
c0100dbd:	c1 e0 02             	shl    $0x2,%eax
c0100dc0:	05 08 e0 12 c0       	add    $0xc012e008,%eax
c0100dc5:	8b 10                	mov    (%eax),%edx
c0100dc7:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100dca:	83 c0 04             	add    $0x4,%eax
c0100dcd:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0100dd0:	8d 59 ff             	lea    -0x1(%ecx),%ebx
c0100dd3:	8b 4d 0c             	mov    0xc(%ebp),%ecx
c0100dd6:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100dda:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100dde:	89 1c 24             	mov    %ebx,(%esp)
c0100de1:	ff d2                	call   *%edx
c0100de3:	eb 23                	jmp    c0100e08 <runcmd+0xb3>
    for (i = 0; i < NCOMMANDS; i ++) {
c0100de5:	ff 45 f4             	incl   -0xc(%ebp)
c0100de8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100deb:	83 f8 02             	cmp    $0x2,%eax
c0100dee:	76 9e                	jbe    c0100d8e <runcmd+0x39>
        }
    }
    cprintf("Unknown command '%s'\n", argv[0]);
c0100df0:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0100df3:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100df7:	c7 04 24 ff c3 10 c0 	movl   $0xc010c3ff,(%esp)
c0100dfe:	e8 ce f4 ff ff       	call   c01002d1 <cprintf>
    return 0;
c0100e03:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100e08:	83 c4 64             	add    $0x64,%esp
c0100e0b:	5b                   	pop    %ebx
c0100e0c:	5d                   	pop    %ebp
c0100e0d:	c3                   	ret    

c0100e0e <kmonitor>:

/***** Implementations of basic kernel monitor commands *****/

void
kmonitor(struct trapframe *tf) {
c0100e0e:	f3 0f 1e fb          	endbr32 
c0100e12:	55                   	push   %ebp
c0100e13:	89 e5                	mov    %esp,%ebp
c0100e15:	83 ec 28             	sub    $0x28,%esp
    cprintf("Welcome to the kernel debug monitor!!\n");
c0100e18:	c7 04 24 18 c4 10 c0 	movl   $0xc010c418,(%esp)
c0100e1f:	e8 ad f4 ff ff       	call   c01002d1 <cprintf>
    cprintf("Type 'help' for a list of commands.\n");
c0100e24:	c7 04 24 40 c4 10 c0 	movl   $0xc010c440,(%esp)
c0100e2b:	e8 a1 f4 ff ff       	call   c01002d1 <cprintf>

    if (tf != NULL) {
c0100e30:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100e34:	74 0b                	je     c0100e41 <kmonitor+0x33>
        print_trapframe(tf);
c0100e36:	8b 45 08             	mov    0x8(%ebp),%eax
c0100e39:	89 04 24             	mov    %eax,(%esp)
c0100e3c:	e8 cc 16 00 00       	call   c010250d <print_trapframe>
    }

    char *buf;
    while (1) {
        if ((buf = readline("K> ")) != NULL) {
c0100e41:	c7 04 24 65 c4 10 c0 	movl   $0xc010c465,(%esp)
c0100e48:	e8 37 f5 ff ff       	call   c0100384 <readline>
c0100e4d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100e50:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100e54:	74 eb                	je     c0100e41 <kmonitor+0x33>
            if (runcmd(buf, tf) < 0) {
c0100e56:	8b 45 08             	mov    0x8(%ebp),%eax
c0100e59:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100e5d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100e60:	89 04 24             	mov    %eax,(%esp)
c0100e63:	e8 ed fe ff ff       	call   c0100d55 <runcmd>
c0100e68:	85 c0                	test   %eax,%eax
c0100e6a:	78 02                	js     c0100e6e <kmonitor+0x60>
        if ((buf = readline("K> ")) != NULL) {
c0100e6c:	eb d3                	jmp    c0100e41 <kmonitor+0x33>
                break;
c0100e6e:	90                   	nop
            }
        }
    }
}
c0100e6f:	90                   	nop
c0100e70:	c9                   	leave  
c0100e71:	c3                   	ret    

c0100e72 <mon_help>:

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
c0100e72:	f3 0f 1e fb          	endbr32 
c0100e76:	55                   	push   %ebp
c0100e77:	89 e5                	mov    %esp,%ebp
c0100e79:	83 ec 28             	sub    $0x28,%esp
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100e7c:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100e83:	eb 3d                	jmp    c0100ec2 <mon_help+0x50>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
c0100e85:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100e88:	89 d0                	mov    %edx,%eax
c0100e8a:	01 c0                	add    %eax,%eax
c0100e8c:	01 d0                	add    %edx,%eax
c0100e8e:	c1 e0 02             	shl    $0x2,%eax
c0100e91:	05 04 e0 12 c0       	add    $0xc012e004,%eax
c0100e96:	8b 08                	mov    (%eax),%ecx
c0100e98:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100e9b:	89 d0                	mov    %edx,%eax
c0100e9d:	01 c0                	add    %eax,%eax
c0100e9f:	01 d0                	add    %edx,%eax
c0100ea1:	c1 e0 02             	shl    $0x2,%eax
c0100ea4:	05 00 e0 12 c0       	add    $0xc012e000,%eax
c0100ea9:	8b 00                	mov    (%eax),%eax
c0100eab:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100eaf:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100eb3:	c7 04 24 69 c4 10 c0 	movl   $0xc010c469,(%esp)
c0100eba:	e8 12 f4 ff ff       	call   c01002d1 <cprintf>
    for (i = 0; i < NCOMMANDS; i ++) {
c0100ebf:	ff 45 f4             	incl   -0xc(%ebp)
c0100ec2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100ec5:	83 f8 02             	cmp    $0x2,%eax
c0100ec8:	76 bb                	jbe    c0100e85 <mon_help+0x13>
    }
    return 0;
c0100eca:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100ecf:	c9                   	leave  
c0100ed0:	c3                   	ret    

c0100ed1 <mon_kerninfo>:
/* *
 * mon_kerninfo - call print_kerninfo in kern/debug/kdebug.c to
 * print the memory occupancy in kernel.
 * */
int
mon_kerninfo(int argc, char **argv, struct trapframe *tf) {
c0100ed1:	f3 0f 1e fb          	endbr32 
c0100ed5:	55                   	push   %ebp
c0100ed6:	89 e5                	mov    %esp,%ebp
c0100ed8:	83 ec 08             	sub    $0x8,%esp
    print_kerninfo();
c0100edb:	e8 a8 fb ff ff       	call   c0100a88 <print_kerninfo>
    return 0;
c0100ee0:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100ee5:	c9                   	leave  
c0100ee6:	c3                   	ret    

c0100ee7 <mon_backtrace>:
/* *
 * mon_backtrace - call print_stackframe in kern/debug/kdebug.c to
 * print a backtrace of the stack.
 * */
int
mon_backtrace(int argc, char **argv, struct trapframe *tf) {
c0100ee7:	f3 0f 1e fb          	endbr32 
c0100eeb:	55                   	push   %ebp
c0100eec:	89 e5                	mov    %esp,%ebp
c0100eee:	83 ec 08             	sub    $0x8,%esp
    print_stackframe();
c0100ef1:	e8 e4 fc ff ff       	call   c0100bda <print_stackframe>
    return 0;
c0100ef6:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100efb:	c9                   	leave  
c0100efc:	c3                   	ret    

c0100efd <ide_wait_ready>:
    unsigned int size;          // Size in Sectors
    unsigned char model[41];    // Model in String
} ide_devices[MAX_IDE];

static int
ide_wait_ready(unsigned short iobase, bool check_error) {
c0100efd:	f3 0f 1e fb          	endbr32 
c0100f01:	55                   	push   %ebp
c0100f02:	89 e5                	mov    %esp,%ebp
c0100f04:	83 ec 14             	sub    $0x14,%esp
c0100f07:	8b 45 08             	mov    0x8(%ebp),%eax
c0100f0a:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    int r;
    while ((r = inb(iobase + ISA_STATUS)) & IDE_BSY)
c0100f0e:	90                   	nop
c0100f0f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100f12:	83 c0 07             	add    $0x7,%eax
c0100f15:	0f b7 c0             	movzwl %ax,%eax
c0100f18:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100f1c:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0100f20:	89 c2                	mov    %eax,%edx
c0100f22:	ec                   	in     (%dx),%al
c0100f23:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0100f26:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0100f2a:	0f b6 c0             	movzbl %al,%eax
c0100f2d:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0100f30:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100f33:	25 80 00 00 00       	and    $0x80,%eax
c0100f38:	85 c0                	test   %eax,%eax
c0100f3a:	75 d3                	jne    c0100f0f <ide_wait_ready+0x12>
        /* nothing */;
    if (check_error && (r & (IDE_DF | IDE_ERR)) != 0) {
c0100f3c:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0100f40:	74 11                	je     c0100f53 <ide_wait_ready+0x56>
c0100f42:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100f45:	83 e0 21             	and    $0x21,%eax
c0100f48:	85 c0                	test   %eax,%eax
c0100f4a:	74 07                	je     c0100f53 <ide_wait_ready+0x56>
        return -1;
c0100f4c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100f51:	eb 05                	jmp    c0100f58 <ide_wait_ready+0x5b>
    }
    return 0;
c0100f53:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100f58:	c9                   	leave  
c0100f59:	c3                   	ret    

c0100f5a <ide_init>:

void
ide_init(void) {
c0100f5a:	f3 0f 1e fb          	endbr32 
c0100f5e:	55                   	push   %ebp
c0100f5f:	89 e5                	mov    %esp,%ebp
c0100f61:	57                   	push   %edi
c0100f62:	53                   	push   %ebx
c0100f63:	81 ec 50 02 00 00    	sub    $0x250,%esp
    static_assert((SECTSIZE % 4) == 0);
    unsigned short ideno, iobase;
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c0100f69:	66 c7 45 f6 00 00    	movw   $0x0,-0xa(%ebp)
c0100f6f:	e9 bd 02 00 00       	jmp    c0101231 <ide_init+0x2d7>
        /* assume that no device here */
        ide_devices[ideno].valid = 0;
c0100f74:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100f78:	89 d0                	mov    %edx,%eax
c0100f7a:	c1 e0 03             	shl    $0x3,%eax
c0100f7d:	29 d0                	sub    %edx,%eax
c0100f7f:	c1 e0 03             	shl    $0x3,%eax
c0100f82:	05 40 14 1b c0       	add    $0xc01b1440,%eax
c0100f87:	c6 00 00             	movb   $0x0,(%eax)

        iobase = IO_BASE(ideno);
c0100f8a:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100f8e:	d1 e8                	shr    %eax
c0100f90:	0f b7 c0             	movzwl %ax,%eax
c0100f93:	8b 04 85 74 c4 10 c0 	mov    -0x3fef3b8c(,%eax,4),%eax
c0100f9a:	66 89 45 ea          	mov    %ax,-0x16(%ebp)

        /* wait device ready */
        ide_wait_ready(iobase, 0);
c0100f9e:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100fa2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100fa9:	00 
c0100faa:	89 04 24             	mov    %eax,(%esp)
c0100fad:	e8 4b ff ff ff       	call   c0100efd <ide_wait_ready>

        /* step1: select drive */
        outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4));
c0100fb2:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100fb6:	c1 e0 04             	shl    $0x4,%eax
c0100fb9:	24 10                	and    $0x10,%al
c0100fbb:	0c e0                	or     $0xe0,%al
c0100fbd:	0f b6 c0             	movzbl %al,%eax
c0100fc0:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0100fc4:	83 c2 06             	add    $0x6,%edx
c0100fc7:	0f b7 d2             	movzwl %dx,%edx
c0100fca:	66 89 55 ca          	mov    %dx,-0x36(%ebp)
c0100fce:	88 45 c9             	mov    %al,-0x37(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100fd1:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c0100fd5:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c0100fd9:	ee                   	out    %al,(%dx)
}
c0100fda:	90                   	nop
        ide_wait_ready(iobase, 0);
c0100fdb:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100fdf:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100fe6:	00 
c0100fe7:	89 04 24             	mov    %eax,(%esp)
c0100fea:	e8 0e ff ff ff       	call   c0100efd <ide_wait_ready>

        /* step2: send ATA identify command */
        outb(iobase + ISA_COMMAND, IDE_CMD_IDENTIFY);
c0100fef:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100ff3:	83 c0 07             	add    $0x7,%eax
c0100ff6:	0f b7 c0             	movzwl %ax,%eax
c0100ff9:	66 89 45 ce          	mov    %ax,-0x32(%ebp)
c0100ffd:	c6 45 cd ec          	movb   $0xec,-0x33(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101001:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c0101005:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c0101009:	ee                   	out    %al,(%dx)
}
c010100a:	90                   	nop
        ide_wait_ready(iobase, 0);
c010100b:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c010100f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101016:	00 
c0101017:	89 04 24             	mov    %eax,(%esp)
c010101a:	e8 de fe ff ff       	call   c0100efd <ide_wait_ready>

        /* step3: polling */
        if (inb(iobase + ISA_STATUS) == 0 || ide_wait_ready(iobase, 1) != 0) {
c010101f:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101023:	83 c0 07             	add    $0x7,%eax
c0101026:	0f b7 c0             	movzwl %ax,%eax
c0101029:	66 89 45 d2          	mov    %ax,-0x2e(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010102d:	0f b7 45 d2          	movzwl -0x2e(%ebp),%eax
c0101031:	89 c2                	mov    %eax,%edx
c0101033:	ec                   	in     (%dx),%al
c0101034:	88 45 d1             	mov    %al,-0x2f(%ebp)
    return data;
c0101037:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c010103b:	84 c0                	test   %al,%al
c010103d:	0f 84 e4 01 00 00    	je     c0101227 <ide_init+0x2cd>
c0101043:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101047:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010104e:	00 
c010104f:	89 04 24             	mov    %eax,(%esp)
c0101052:	e8 a6 fe ff ff       	call   c0100efd <ide_wait_ready>
c0101057:	85 c0                	test   %eax,%eax
c0101059:	0f 85 c8 01 00 00    	jne    c0101227 <ide_init+0x2cd>
            continue ;
        }

        /* device is ok */
        ide_devices[ideno].valid = 1;
c010105f:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101063:	89 d0                	mov    %edx,%eax
c0101065:	c1 e0 03             	shl    $0x3,%eax
c0101068:	29 d0                	sub    %edx,%eax
c010106a:	c1 e0 03             	shl    $0x3,%eax
c010106d:	05 40 14 1b c0       	add    $0xc01b1440,%eax
c0101072:	c6 00 01             	movb   $0x1,(%eax)

        /* read identification space of the device */
        unsigned int buffer[128];
        insl(iobase + ISA_DATA, buffer, sizeof(buffer) / sizeof(unsigned int));
c0101075:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101079:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c010107c:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0101082:	89 45 c0             	mov    %eax,-0x40(%ebp)
c0101085:	c7 45 bc 80 00 00 00 	movl   $0x80,-0x44(%ebp)
    asm volatile (
c010108c:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c010108f:	8b 4d c0             	mov    -0x40(%ebp),%ecx
c0101092:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0101095:	89 cb                	mov    %ecx,%ebx
c0101097:	89 df                	mov    %ebx,%edi
c0101099:	89 c1                	mov    %eax,%ecx
c010109b:	fc                   	cld    
c010109c:	f2 6d                	repnz insl (%dx),%es:(%edi)
c010109e:	89 c8                	mov    %ecx,%eax
c01010a0:	89 fb                	mov    %edi,%ebx
c01010a2:	89 5d c0             	mov    %ebx,-0x40(%ebp)
c01010a5:	89 45 bc             	mov    %eax,-0x44(%ebp)
}
c01010a8:	90                   	nop

        unsigned char *ident = (unsigned char *)buffer;
c01010a9:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c01010af:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        unsigned int sectors;
        unsigned int cmdsets = *(unsigned int *)(ident + IDE_IDENT_CMDSETS);
c01010b2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01010b5:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
c01010bb:	89 45 e0             	mov    %eax,-0x20(%ebp)
        /* device use 48-bits or 28-bits addressing */
        if (cmdsets & (1 << 26)) {
c01010be:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01010c1:	25 00 00 00 04       	and    $0x4000000,%eax
c01010c6:	85 c0                	test   %eax,%eax
c01010c8:	74 0e                	je     c01010d8 <ide_init+0x17e>
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA_EXT);
c01010ca:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01010cd:	8b 80 c8 00 00 00    	mov    0xc8(%eax),%eax
c01010d3:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01010d6:	eb 09                	jmp    c01010e1 <ide_init+0x187>
        }
        else {
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA);
c01010d8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01010db:	8b 40 78             	mov    0x78(%eax),%eax
c01010de:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        ide_devices[ideno].sets = cmdsets;
c01010e1:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01010e5:	89 d0                	mov    %edx,%eax
c01010e7:	c1 e0 03             	shl    $0x3,%eax
c01010ea:	29 d0                	sub    %edx,%eax
c01010ec:	c1 e0 03             	shl    $0x3,%eax
c01010ef:	8d 90 44 14 1b c0    	lea    -0x3fe4ebbc(%eax),%edx
c01010f5:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01010f8:	89 02                	mov    %eax,(%edx)
        ide_devices[ideno].size = sectors;
c01010fa:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01010fe:	89 d0                	mov    %edx,%eax
c0101100:	c1 e0 03             	shl    $0x3,%eax
c0101103:	29 d0                	sub    %edx,%eax
c0101105:	c1 e0 03             	shl    $0x3,%eax
c0101108:	8d 90 48 14 1b c0    	lea    -0x3fe4ebb8(%eax),%edx
c010110e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101111:	89 02                	mov    %eax,(%edx)

        /* check if supports LBA */
        assert((*(unsigned short *)(ident + IDE_IDENT_CAPABILITIES) & 0x200) != 0);
c0101113:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101116:	83 c0 62             	add    $0x62,%eax
c0101119:	0f b7 00             	movzwl (%eax),%eax
c010111c:	25 00 02 00 00       	and    $0x200,%eax
c0101121:	85 c0                	test   %eax,%eax
c0101123:	75 24                	jne    c0101149 <ide_init+0x1ef>
c0101125:	c7 44 24 0c 7c c4 10 	movl   $0xc010c47c,0xc(%esp)
c010112c:	c0 
c010112d:	c7 44 24 08 bf c4 10 	movl   $0xc010c4bf,0x8(%esp)
c0101134:	c0 
c0101135:	c7 44 24 04 7d 00 00 	movl   $0x7d,0x4(%esp)
c010113c:	00 
c010113d:	c7 04 24 d4 c4 10 c0 	movl   $0xc010c4d4,(%esp)
c0101144:	e8 f4 f2 ff ff       	call   c010043d <__panic>

        unsigned char *model = ide_devices[ideno].model, *data = ident + IDE_IDENT_MODEL;
c0101149:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c010114d:	89 d0                	mov    %edx,%eax
c010114f:	c1 e0 03             	shl    $0x3,%eax
c0101152:	29 d0                	sub    %edx,%eax
c0101154:	c1 e0 03             	shl    $0x3,%eax
c0101157:	05 40 14 1b c0       	add    $0xc01b1440,%eax
c010115c:	83 c0 0c             	add    $0xc,%eax
c010115f:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0101162:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101165:	83 c0 36             	add    $0x36,%eax
c0101168:	89 45 d8             	mov    %eax,-0x28(%ebp)
        unsigned int i, length = 40;
c010116b:	c7 45 d4 28 00 00 00 	movl   $0x28,-0x2c(%ebp)
        for (i = 0; i < length; i += 2) {
c0101172:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0101179:	eb 34                	jmp    c01011af <ide_init+0x255>
            model[i] = data[i + 1], model[i + 1] = data[i];
c010117b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010117e:	8d 50 01             	lea    0x1(%eax),%edx
c0101181:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0101184:	01 c2                	add    %eax,%edx
c0101186:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0101189:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010118c:	01 c8                	add    %ecx,%eax
c010118e:	0f b6 12             	movzbl (%edx),%edx
c0101191:	88 10                	mov    %dl,(%eax)
c0101193:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0101196:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101199:	01 c2                	add    %eax,%edx
c010119b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010119e:	8d 48 01             	lea    0x1(%eax),%ecx
c01011a1:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01011a4:	01 c8                	add    %ecx,%eax
c01011a6:	0f b6 12             	movzbl (%edx),%edx
c01011a9:	88 10                	mov    %dl,(%eax)
        for (i = 0; i < length; i += 2) {
c01011ab:	83 45 ec 02          	addl   $0x2,-0x14(%ebp)
c01011af:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01011b2:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c01011b5:	72 c4                	jb     c010117b <ide_init+0x221>
        }
        do {
            model[i] = '\0';
c01011b7:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01011ba:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01011bd:	01 d0                	add    %edx,%eax
c01011bf:	c6 00 00             	movb   $0x0,(%eax)
        } while (i -- > 0 && model[i] == ' ');
c01011c2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01011c5:	8d 50 ff             	lea    -0x1(%eax),%edx
c01011c8:	89 55 ec             	mov    %edx,-0x14(%ebp)
c01011cb:	85 c0                	test   %eax,%eax
c01011cd:	74 0f                	je     c01011de <ide_init+0x284>
c01011cf:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01011d2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01011d5:	01 d0                	add    %edx,%eax
c01011d7:	0f b6 00             	movzbl (%eax),%eax
c01011da:	3c 20                	cmp    $0x20,%al
c01011dc:	74 d9                	je     c01011b7 <ide_init+0x25d>

        cprintf("ide %d: %10u(sectors), '%s'.\n", ideno, ide_devices[ideno].size, ide_devices[ideno].model);
c01011de:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01011e2:	89 d0                	mov    %edx,%eax
c01011e4:	c1 e0 03             	shl    $0x3,%eax
c01011e7:	29 d0                	sub    %edx,%eax
c01011e9:	c1 e0 03             	shl    $0x3,%eax
c01011ec:	05 40 14 1b c0       	add    $0xc01b1440,%eax
c01011f1:	8d 48 0c             	lea    0xc(%eax),%ecx
c01011f4:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01011f8:	89 d0                	mov    %edx,%eax
c01011fa:	c1 e0 03             	shl    $0x3,%eax
c01011fd:	29 d0                	sub    %edx,%eax
c01011ff:	c1 e0 03             	shl    $0x3,%eax
c0101202:	05 48 14 1b c0       	add    $0xc01b1448,%eax
c0101207:	8b 10                	mov    (%eax),%edx
c0101209:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010120d:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0101211:	89 54 24 08          	mov    %edx,0x8(%esp)
c0101215:	89 44 24 04          	mov    %eax,0x4(%esp)
c0101219:	c7 04 24 e6 c4 10 c0 	movl   $0xc010c4e6,(%esp)
c0101220:	e8 ac f0 ff ff       	call   c01002d1 <cprintf>
c0101225:	eb 01                	jmp    c0101228 <ide_init+0x2ce>
            continue ;
c0101227:	90                   	nop
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c0101228:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010122c:	40                   	inc    %eax
c010122d:	66 89 45 f6          	mov    %ax,-0xa(%ebp)
c0101231:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101235:	83 f8 03             	cmp    $0x3,%eax
c0101238:	0f 86 36 fd ff ff    	jbe    c0100f74 <ide_init+0x1a>
    }

    // enable ide interrupt
    pic_enable(IRQ_IDE1);
c010123e:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
c0101245:	e8 1f 0f 00 00       	call   c0102169 <pic_enable>
    pic_enable(IRQ_IDE2);
c010124a:	c7 04 24 0f 00 00 00 	movl   $0xf,(%esp)
c0101251:	e8 13 0f 00 00       	call   c0102169 <pic_enable>
}
c0101256:	90                   	nop
c0101257:	81 c4 50 02 00 00    	add    $0x250,%esp
c010125d:	5b                   	pop    %ebx
c010125e:	5f                   	pop    %edi
c010125f:	5d                   	pop    %ebp
c0101260:	c3                   	ret    

c0101261 <ide_device_valid>:

bool
ide_device_valid(unsigned short ideno) {
c0101261:	f3 0f 1e fb          	endbr32 
c0101265:	55                   	push   %ebp
c0101266:	89 e5                	mov    %esp,%ebp
c0101268:	83 ec 04             	sub    $0x4,%esp
c010126b:	8b 45 08             	mov    0x8(%ebp),%eax
c010126e:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    return VALID_IDE(ideno);
c0101272:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c0101276:	83 f8 03             	cmp    $0x3,%eax
c0101279:	77 21                	ja     c010129c <ide_device_valid+0x3b>
c010127b:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
c010127f:	89 d0                	mov    %edx,%eax
c0101281:	c1 e0 03             	shl    $0x3,%eax
c0101284:	29 d0                	sub    %edx,%eax
c0101286:	c1 e0 03             	shl    $0x3,%eax
c0101289:	05 40 14 1b c0       	add    $0xc01b1440,%eax
c010128e:	0f b6 00             	movzbl (%eax),%eax
c0101291:	84 c0                	test   %al,%al
c0101293:	74 07                	je     c010129c <ide_device_valid+0x3b>
c0101295:	b8 01 00 00 00       	mov    $0x1,%eax
c010129a:	eb 05                	jmp    c01012a1 <ide_device_valid+0x40>
c010129c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01012a1:	c9                   	leave  
c01012a2:	c3                   	ret    

c01012a3 <ide_device_size>:

size_t
ide_device_size(unsigned short ideno) {
c01012a3:	f3 0f 1e fb          	endbr32 
c01012a7:	55                   	push   %ebp
c01012a8:	89 e5                	mov    %esp,%ebp
c01012aa:	83 ec 08             	sub    $0x8,%esp
c01012ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01012b0:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    if (ide_device_valid(ideno)) {
c01012b4:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c01012b8:	89 04 24             	mov    %eax,(%esp)
c01012bb:	e8 a1 ff ff ff       	call   c0101261 <ide_device_valid>
c01012c0:	85 c0                	test   %eax,%eax
c01012c2:	74 17                	je     c01012db <ide_device_size+0x38>
        return ide_devices[ideno].size;
c01012c4:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
c01012c8:	89 d0                	mov    %edx,%eax
c01012ca:	c1 e0 03             	shl    $0x3,%eax
c01012cd:	29 d0                	sub    %edx,%eax
c01012cf:	c1 e0 03             	shl    $0x3,%eax
c01012d2:	05 48 14 1b c0       	add    $0xc01b1448,%eax
c01012d7:	8b 00                	mov    (%eax),%eax
c01012d9:	eb 05                	jmp    c01012e0 <ide_device_size+0x3d>
    }
    return 0;
c01012db:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01012e0:	c9                   	leave  
c01012e1:	c3                   	ret    

c01012e2 <ide_read_secs>:

int
ide_read_secs(unsigned short ideno, uint32_t secno, void *dst, size_t nsecs) {
c01012e2:	f3 0f 1e fb          	endbr32 
c01012e6:	55                   	push   %ebp
c01012e7:	89 e5                	mov    %esp,%ebp
c01012e9:	57                   	push   %edi
c01012ea:	53                   	push   %ebx
c01012eb:	83 ec 50             	sub    $0x50,%esp
c01012ee:	8b 45 08             	mov    0x8(%ebp),%eax
c01012f1:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c01012f5:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c01012fc:	77 23                	ja     c0101321 <ide_read_secs+0x3f>
c01012fe:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101302:	83 f8 03             	cmp    $0x3,%eax
c0101305:	77 1a                	ja     c0101321 <ide_read_secs+0x3f>
c0101307:	0f b7 55 c4          	movzwl -0x3c(%ebp),%edx
c010130b:	89 d0                	mov    %edx,%eax
c010130d:	c1 e0 03             	shl    $0x3,%eax
c0101310:	29 d0                	sub    %edx,%eax
c0101312:	c1 e0 03             	shl    $0x3,%eax
c0101315:	05 40 14 1b c0       	add    $0xc01b1440,%eax
c010131a:	0f b6 00             	movzbl (%eax),%eax
c010131d:	84 c0                	test   %al,%al
c010131f:	75 24                	jne    c0101345 <ide_read_secs+0x63>
c0101321:	c7 44 24 0c 04 c5 10 	movl   $0xc010c504,0xc(%esp)
c0101328:	c0 
c0101329:	c7 44 24 08 bf c4 10 	movl   $0xc010c4bf,0x8(%esp)
c0101330:	c0 
c0101331:	c7 44 24 04 9f 00 00 	movl   $0x9f,0x4(%esp)
c0101338:	00 
c0101339:	c7 04 24 d4 c4 10 c0 	movl   $0xc010c4d4,(%esp)
c0101340:	e8 f8 f0 ff ff       	call   c010043d <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c0101345:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c010134c:	77 0f                	ja     c010135d <ide_read_secs+0x7b>
c010134e:	8b 55 0c             	mov    0xc(%ebp),%edx
c0101351:	8b 45 14             	mov    0x14(%ebp),%eax
c0101354:	01 d0                	add    %edx,%eax
c0101356:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c010135b:	76 24                	jbe    c0101381 <ide_read_secs+0x9f>
c010135d:	c7 44 24 0c 2c c5 10 	movl   $0xc010c52c,0xc(%esp)
c0101364:	c0 
c0101365:	c7 44 24 08 bf c4 10 	movl   $0xc010c4bf,0x8(%esp)
c010136c:	c0 
c010136d:	c7 44 24 04 a0 00 00 	movl   $0xa0,0x4(%esp)
c0101374:	00 
c0101375:	c7 04 24 d4 c4 10 c0 	movl   $0xc010c4d4,(%esp)
c010137c:	e8 bc f0 ff ff       	call   c010043d <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c0101381:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101385:	d1 e8                	shr    %eax
c0101387:	0f b7 c0             	movzwl %ax,%eax
c010138a:	8b 04 85 74 c4 10 c0 	mov    -0x3fef3b8c(,%eax,4),%eax
c0101391:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0101395:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101399:	d1 e8                	shr    %eax
c010139b:	0f b7 c0             	movzwl %ax,%eax
c010139e:	0f b7 04 85 76 c4 10 	movzwl -0x3fef3b8a(,%eax,4),%eax
c01013a5:	c0 
c01013a6:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c01013aa:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01013ae:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01013b5:	00 
c01013b6:	89 04 24             	mov    %eax,(%esp)
c01013b9:	e8 3f fb ff ff       	call   c0100efd <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c01013be:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01013c1:	83 c0 02             	add    $0x2,%eax
c01013c4:	0f b7 c0             	movzwl %ax,%eax
c01013c7:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c01013cb:	c6 45 d5 00          	movb   $0x0,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01013cf:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c01013d3:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c01013d7:	ee                   	out    %al,(%dx)
}
c01013d8:	90                   	nop
    outb(iobase + ISA_SECCNT, nsecs);
c01013d9:	8b 45 14             	mov    0x14(%ebp),%eax
c01013dc:	0f b6 c0             	movzbl %al,%eax
c01013df:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01013e3:	83 c2 02             	add    $0x2,%edx
c01013e6:	0f b7 d2             	movzwl %dx,%edx
c01013e9:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c01013ed:	88 45 d9             	mov    %al,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01013f0:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c01013f4:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c01013f8:	ee                   	out    %al,(%dx)
}
c01013f9:	90                   	nop
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c01013fa:	8b 45 0c             	mov    0xc(%ebp),%eax
c01013fd:	0f b6 c0             	movzbl %al,%eax
c0101400:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101404:	83 c2 03             	add    $0x3,%edx
c0101407:	0f b7 d2             	movzwl %dx,%edx
c010140a:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c010140e:	88 45 dd             	mov    %al,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101411:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101415:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0101419:	ee                   	out    %al,(%dx)
}
c010141a:	90                   	nop
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c010141b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010141e:	c1 e8 08             	shr    $0x8,%eax
c0101421:	0f b6 c0             	movzbl %al,%eax
c0101424:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101428:	83 c2 04             	add    $0x4,%edx
c010142b:	0f b7 d2             	movzwl %dx,%edx
c010142e:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101432:	88 45 e1             	mov    %al,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101435:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0101439:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c010143d:	ee                   	out    %al,(%dx)
}
c010143e:	90                   	nop
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c010143f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101442:	c1 e8 10             	shr    $0x10,%eax
c0101445:	0f b6 c0             	movzbl %al,%eax
c0101448:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010144c:	83 c2 05             	add    $0x5,%edx
c010144f:	0f b7 d2             	movzwl %dx,%edx
c0101452:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c0101456:	88 45 e5             	mov    %al,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101459:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c010145d:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101461:	ee                   	out    %al,(%dx)
}
c0101462:	90                   	nop
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c0101463:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0101466:	c0 e0 04             	shl    $0x4,%al
c0101469:	24 10                	and    $0x10,%al
c010146b:	88 c2                	mov    %al,%dl
c010146d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101470:	c1 e8 18             	shr    $0x18,%eax
c0101473:	24 0f                	and    $0xf,%al
c0101475:	08 d0                	or     %dl,%al
c0101477:	0c e0                	or     $0xe0,%al
c0101479:	0f b6 c0             	movzbl %al,%eax
c010147c:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101480:	83 c2 06             	add    $0x6,%edx
c0101483:	0f b7 d2             	movzwl %dx,%edx
c0101486:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c010148a:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010148d:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101491:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101495:	ee                   	out    %al,(%dx)
}
c0101496:	90                   	nop
    outb(iobase + ISA_COMMAND, IDE_CMD_READ);
c0101497:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c010149b:	83 c0 07             	add    $0x7,%eax
c010149e:	0f b7 c0             	movzwl %ax,%eax
c01014a1:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c01014a5:	c6 45 ed 20          	movb   $0x20,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01014a9:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01014ad:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01014b1:	ee                   	out    %al,(%dx)
}
c01014b2:	90                   	nop

    int ret = 0;
c01014b3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c01014ba:	eb 58                	jmp    c0101514 <ide_read_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c01014bc:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01014c0:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01014c7:	00 
c01014c8:	89 04 24             	mov    %eax,(%esp)
c01014cb:	e8 2d fa ff ff       	call   c0100efd <ide_wait_ready>
c01014d0:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01014d3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01014d7:	75 43                	jne    c010151c <ide_read_secs+0x23a>
            goto out;
        }
        insl(iobase, dst, SECTSIZE / sizeof(uint32_t));
c01014d9:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01014dd:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01014e0:	8b 45 10             	mov    0x10(%ebp),%eax
c01014e3:	89 45 cc             	mov    %eax,-0x34(%ebp)
c01014e6:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile (
c01014ed:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01014f0:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c01014f3:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01014f6:	89 cb                	mov    %ecx,%ebx
c01014f8:	89 df                	mov    %ebx,%edi
c01014fa:	89 c1                	mov    %eax,%ecx
c01014fc:	fc                   	cld    
c01014fd:	f2 6d                	repnz insl (%dx),%es:(%edi)
c01014ff:	89 c8                	mov    %ecx,%eax
c0101501:	89 fb                	mov    %edi,%ebx
c0101503:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c0101506:	89 45 c8             	mov    %eax,-0x38(%ebp)
}
c0101509:	90                   	nop
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c010150a:	ff 4d 14             	decl   0x14(%ebp)
c010150d:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101514:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0101518:	75 a2                	jne    c01014bc <ide_read_secs+0x1da>
    }

out:
c010151a:	eb 01                	jmp    c010151d <ide_read_secs+0x23b>
            goto out;
c010151c:	90                   	nop
    return ret;
c010151d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101520:	83 c4 50             	add    $0x50,%esp
c0101523:	5b                   	pop    %ebx
c0101524:	5f                   	pop    %edi
c0101525:	5d                   	pop    %ebp
c0101526:	c3                   	ret    

c0101527 <ide_write_secs>:

int
ide_write_secs(unsigned short ideno, uint32_t secno, const void *src, size_t nsecs) {
c0101527:	f3 0f 1e fb          	endbr32 
c010152b:	55                   	push   %ebp
c010152c:	89 e5                	mov    %esp,%ebp
c010152e:	56                   	push   %esi
c010152f:	53                   	push   %ebx
c0101530:	83 ec 50             	sub    $0x50,%esp
c0101533:	8b 45 08             	mov    0x8(%ebp),%eax
c0101536:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c010153a:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101541:	77 23                	ja     c0101566 <ide_write_secs+0x3f>
c0101543:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101547:	83 f8 03             	cmp    $0x3,%eax
c010154a:	77 1a                	ja     c0101566 <ide_write_secs+0x3f>
c010154c:	0f b7 55 c4          	movzwl -0x3c(%ebp),%edx
c0101550:	89 d0                	mov    %edx,%eax
c0101552:	c1 e0 03             	shl    $0x3,%eax
c0101555:	29 d0                	sub    %edx,%eax
c0101557:	c1 e0 03             	shl    $0x3,%eax
c010155a:	05 40 14 1b c0       	add    $0xc01b1440,%eax
c010155f:	0f b6 00             	movzbl (%eax),%eax
c0101562:	84 c0                	test   %al,%al
c0101564:	75 24                	jne    c010158a <ide_write_secs+0x63>
c0101566:	c7 44 24 0c 04 c5 10 	movl   $0xc010c504,0xc(%esp)
c010156d:	c0 
c010156e:	c7 44 24 08 bf c4 10 	movl   $0xc010c4bf,0x8(%esp)
c0101575:	c0 
c0101576:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c010157d:	00 
c010157e:	c7 04 24 d4 c4 10 c0 	movl   $0xc010c4d4,(%esp)
c0101585:	e8 b3 ee ff ff       	call   c010043d <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c010158a:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c0101591:	77 0f                	ja     c01015a2 <ide_write_secs+0x7b>
c0101593:	8b 55 0c             	mov    0xc(%ebp),%edx
c0101596:	8b 45 14             	mov    0x14(%ebp),%eax
c0101599:	01 d0                	add    %edx,%eax
c010159b:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c01015a0:	76 24                	jbe    c01015c6 <ide_write_secs+0x9f>
c01015a2:	c7 44 24 0c 2c c5 10 	movl   $0xc010c52c,0xc(%esp)
c01015a9:	c0 
c01015aa:	c7 44 24 08 bf c4 10 	movl   $0xc010c4bf,0x8(%esp)
c01015b1:	c0 
c01015b2:	c7 44 24 04 bd 00 00 	movl   $0xbd,0x4(%esp)
c01015b9:	00 
c01015ba:	c7 04 24 d4 c4 10 c0 	movl   $0xc010c4d4,(%esp)
c01015c1:	e8 77 ee ff ff       	call   c010043d <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c01015c6:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c01015ca:	d1 e8                	shr    %eax
c01015cc:	0f b7 c0             	movzwl %ax,%eax
c01015cf:	8b 04 85 74 c4 10 c0 	mov    -0x3fef3b8c(,%eax,4),%eax
c01015d6:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c01015da:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c01015de:	d1 e8                	shr    %eax
c01015e0:	0f b7 c0             	movzwl %ax,%eax
c01015e3:	0f b7 04 85 76 c4 10 	movzwl -0x3fef3b8a(,%eax,4),%eax
c01015ea:	c0 
c01015eb:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c01015ef:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01015f3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01015fa:	00 
c01015fb:	89 04 24             	mov    %eax,(%esp)
c01015fe:	e8 fa f8 ff ff       	call   c0100efd <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c0101603:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101606:	83 c0 02             	add    $0x2,%eax
c0101609:	0f b7 c0             	movzwl %ax,%eax
c010160c:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c0101610:	c6 45 d5 00          	movb   $0x0,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101614:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101618:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c010161c:	ee                   	out    %al,(%dx)
}
c010161d:	90                   	nop
    outb(iobase + ISA_SECCNT, nsecs);
c010161e:	8b 45 14             	mov    0x14(%ebp),%eax
c0101621:	0f b6 c0             	movzbl %al,%eax
c0101624:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101628:	83 c2 02             	add    $0x2,%edx
c010162b:	0f b7 d2             	movzwl %dx,%edx
c010162e:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c0101632:	88 45 d9             	mov    %al,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101635:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101639:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c010163d:	ee                   	out    %al,(%dx)
}
c010163e:	90                   	nop
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c010163f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101642:	0f b6 c0             	movzbl %al,%eax
c0101645:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101649:	83 c2 03             	add    $0x3,%edx
c010164c:	0f b7 d2             	movzwl %dx,%edx
c010164f:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c0101653:	88 45 dd             	mov    %al,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101656:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c010165a:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c010165e:	ee                   	out    %al,(%dx)
}
c010165f:	90                   	nop
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c0101660:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101663:	c1 e8 08             	shr    $0x8,%eax
c0101666:	0f b6 c0             	movzbl %al,%eax
c0101669:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010166d:	83 c2 04             	add    $0x4,%edx
c0101670:	0f b7 d2             	movzwl %dx,%edx
c0101673:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101677:	88 45 e1             	mov    %al,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010167a:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c010167e:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101682:	ee                   	out    %al,(%dx)
}
c0101683:	90                   	nop
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c0101684:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101687:	c1 e8 10             	shr    $0x10,%eax
c010168a:	0f b6 c0             	movzbl %al,%eax
c010168d:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101691:	83 c2 05             	add    $0x5,%edx
c0101694:	0f b7 d2             	movzwl %dx,%edx
c0101697:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c010169b:	88 45 e5             	mov    %al,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010169e:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01016a2:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01016a6:	ee                   	out    %al,(%dx)
}
c01016a7:	90                   	nop
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c01016a8:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01016ab:	c0 e0 04             	shl    $0x4,%al
c01016ae:	24 10                	and    $0x10,%al
c01016b0:	88 c2                	mov    %al,%dl
c01016b2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01016b5:	c1 e8 18             	shr    $0x18,%eax
c01016b8:	24 0f                	and    $0xf,%al
c01016ba:	08 d0                	or     %dl,%al
c01016bc:	0c e0                	or     $0xe0,%al
c01016be:	0f b6 c0             	movzbl %al,%eax
c01016c1:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01016c5:	83 c2 06             	add    $0x6,%edx
c01016c8:	0f b7 d2             	movzwl %dx,%edx
c01016cb:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c01016cf:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01016d2:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01016d6:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01016da:	ee                   	out    %al,(%dx)
}
c01016db:	90                   	nop
    outb(iobase + ISA_COMMAND, IDE_CMD_WRITE);
c01016dc:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01016e0:	83 c0 07             	add    $0x7,%eax
c01016e3:	0f b7 c0             	movzwl %ax,%eax
c01016e6:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c01016ea:	c6 45 ed 30          	movb   $0x30,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01016ee:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01016f2:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01016f6:	ee                   	out    %al,(%dx)
}
c01016f7:	90                   	nop

    int ret = 0;
c01016f8:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c01016ff:	eb 58                	jmp    c0101759 <ide_write_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c0101701:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101705:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010170c:	00 
c010170d:	89 04 24             	mov    %eax,(%esp)
c0101710:	e8 e8 f7 ff ff       	call   c0100efd <ide_wait_ready>
c0101715:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101718:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010171c:	75 43                	jne    c0101761 <ide_write_secs+0x23a>
            goto out;
        }
        outsl(iobase, src, SECTSIZE / sizeof(uint32_t));
c010171e:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101722:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0101725:	8b 45 10             	mov    0x10(%ebp),%eax
c0101728:	89 45 cc             	mov    %eax,-0x34(%ebp)
c010172b:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile (
c0101732:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0101735:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c0101738:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010173b:	89 cb                	mov    %ecx,%ebx
c010173d:	89 de                	mov    %ebx,%esi
c010173f:	89 c1                	mov    %eax,%ecx
c0101741:	fc                   	cld    
c0101742:	f2 6f                	repnz outsl %ds:(%esi),(%dx)
c0101744:	89 c8                	mov    %ecx,%eax
c0101746:	89 f3                	mov    %esi,%ebx
c0101748:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c010174b:	89 45 c8             	mov    %eax,-0x38(%ebp)
}
c010174e:	90                   	nop
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c010174f:	ff 4d 14             	decl   0x14(%ebp)
c0101752:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101759:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c010175d:	75 a2                	jne    c0101701 <ide_write_secs+0x1da>
    }

out:
c010175f:	eb 01                	jmp    c0101762 <ide_write_secs+0x23b>
            goto out;
c0101761:	90                   	nop
    return ret;
c0101762:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101765:	83 c4 50             	add    $0x50,%esp
c0101768:	5b                   	pop    %ebx
c0101769:	5e                   	pop    %esi
c010176a:	5d                   	pop    %ebp
c010176b:	c3                   	ret    

c010176c <clock_init>:
/* *
 * clock_init - initialize 8253 clock to interrupt 100 times per second,
 * and then enable IRQ_TIMER.
 * */
void
clock_init(void) {
c010176c:	f3 0f 1e fb          	endbr32 
c0101770:	55                   	push   %ebp
c0101771:	89 e5                	mov    %esp,%ebp
c0101773:	83 ec 28             	sub    $0x28,%esp
c0101776:	66 c7 45 ee 43 00    	movw   $0x43,-0x12(%ebp)
c010177c:	c6 45 ed 34          	movb   $0x34,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101780:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101784:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101788:	ee                   	out    %al,(%dx)
}
c0101789:	90                   	nop
c010178a:	66 c7 45 f2 40 00    	movw   $0x40,-0xe(%ebp)
c0101790:	c6 45 f1 9c          	movb   $0x9c,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101794:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101798:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010179c:	ee                   	out    %al,(%dx)
}
c010179d:	90                   	nop
c010179e:	66 c7 45 f6 40 00    	movw   $0x40,-0xa(%ebp)
c01017a4:	c6 45 f5 2e          	movb   $0x2e,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01017a8:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c01017ac:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01017b0:	ee                   	out    %al,(%dx)
}
c01017b1:	90                   	nop
    outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
    outb(IO_TIMER1, TIMER_DIV(100) % 256);
    outb(IO_TIMER1, TIMER_DIV(100) / 256);

    // initialize time counter 'ticks' to zero
    ticks = 0;
c01017b2:	c7 05 54 40 1b c0 00 	movl   $0x0,0xc01b4054
c01017b9:	00 00 00 

    cprintf("++ setup timer interrupts\n");
c01017bc:	c7 04 24 66 c5 10 c0 	movl   $0xc010c566,(%esp)
c01017c3:	e8 09 eb ff ff       	call   c01002d1 <cprintf>
    pic_enable(IRQ_TIMER);
c01017c8:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01017cf:	e8 95 09 00 00       	call   c0102169 <pic_enable>
}
c01017d4:	90                   	nop
c01017d5:	c9                   	leave  
c01017d6:	c3                   	ret    

c01017d7 <__intr_save>:
#include <assert.h>
#include <atomic.h>
#include <sched.h>

static inline bool
__intr_save(void) {
c01017d7:	55                   	push   %ebp
c01017d8:	89 e5                	mov    %esp,%ebp
c01017da:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01017dd:	9c                   	pushf  
c01017de:	58                   	pop    %eax
c01017df:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01017e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01017e5:	25 00 02 00 00       	and    $0x200,%eax
c01017ea:	85 c0                	test   %eax,%eax
c01017ec:	74 0c                	je     c01017fa <__intr_save+0x23>
        intr_disable();
c01017ee:	e8 05 0b 00 00       	call   c01022f8 <intr_disable>
        return 1;
c01017f3:	b8 01 00 00 00       	mov    $0x1,%eax
c01017f8:	eb 05                	jmp    c01017ff <__intr_save+0x28>
    }
    return 0;
c01017fa:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01017ff:	c9                   	leave  
c0101800:	c3                   	ret    

c0101801 <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0101801:	55                   	push   %ebp
c0101802:	89 e5                	mov    %esp,%ebp
c0101804:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0101807:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010180b:	74 05                	je     c0101812 <__intr_restore+0x11>
        intr_enable();
c010180d:	e8 da 0a 00 00       	call   c01022ec <intr_enable>
    }
}
c0101812:	90                   	nop
c0101813:	c9                   	leave  
c0101814:	c3                   	ret    

c0101815 <delay>:
#include <memlayout.h>
#include <sync.h>

/* stupid I/O delay routine necessitated by historical PC design flaws */
static void
delay(void) {
c0101815:	f3 0f 1e fb          	endbr32 
c0101819:	55                   	push   %ebp
c010181a:	89 e5                	mov    %esp,%ebp
c010181c:	83 ec 10             	sub    $0x10,%esp
c010181f:	66 c7 45 f2 84 00    	movw   $0x84,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101825:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101829:	89 c2                	mov    %eax,%edx
c010182b:	ec                   	in     (%dx),%al
c010182c:	88 45 f1             	mov    %al,-0xf(%ebp)
c010182f:	66 c7 45 f6 84 00    	movw   $0x84,-0xa(%ebp)
c0101835:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101839:	89 c2                	mov    %eax,%edx
c010183b:	ec                   	in     (%dx),%al
c010183c:	88 45 f5             	mov    %al,-0xb(%ebp)
c010183f:	66 c7 45 fa 84 00    	movw   $0x84,-0x6(%ebp)
c0101845:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101849:	89 c2                	mov    %eax,%edx
c010184b:	ec                   	in     (%dx),%al
c010184c:	88 45 f9             	mov    %al,-0x7(%ebp)
c010184f:	66 c7 45 fe 84 00    	movw   $0x84,-0x2(%ebp)
c0101855:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0101859:	89 c2                	mov    %eax,%edx
c010185b:	ec                   	in     (%dx),%al
c010185c:	88 45 fd             	mov    %al,-0x3(%ebp)
    inb(0x84);
    inb(0x84);
    inb(0x84);
    inb(0x84);
}
c010185f:	90                   	nop
c0101860:	c9                   	leave  
c0101861:	c3                   	ret    

c0101862 <cga_init>:
static uint16_t addr_6845;

/* TEXT-mode CGA/VGA display output */

static void
cga_init(void) {
c0101862:	f3 0f 1e fb          	endbr32 
c0101866:	55                   	push   %ebp
c0101867:	89 e5                	mov    %esp,%ebp
c0101869:	83 ec 20             	sub    $0x20,%esp
    volatile uint16_t *cp = (uint16_t *)(CGA_BUF + KERNBASE);
c010186c:	c7 45 fc 00 80 0b c0 	movl   $0xc00b8000,-0x4(%ebp)
    uint16_t was = *cp;
c0101873:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101876:	0f b7 00             	movzwl (%eax),%eax
c0101879:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
    *cp = (uint16_t) 0xA55A;
c010187d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101880:	66 c7 00 5a a5       	movw   $0xa55a,(%eax)
    if (*cp != 0xA55A) {
c0101885:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101888:	0f b7 00             	movzwl (%eax),%eax
c010188b:	0f b7 c0             	movzwl %ax,%eax
c010188e:	3d 5a a5 00 00       	cmp    $0xa55a,%eax
c0101893:	74 12                	je     c01018a7 <cga_init+0x45>
        cp = (uint16_t*)(MONO_BUF + KERNBASE);
c0101895:	c7 45 fc 00 00 0b c0 	movl   $0xc00b0000,-0x4(%ebp)
        addr_6845 = MONO_BASE;
c010189c:	66 c7 05 26 15 1b c0 	movw   $0x3b4,0xc01b1526
c01018a3:	b4 03 
c01018a5:	eb 13                	jmp    c01018ba <cga_init+0x58>
    } else {
        *cp = was;
c01018a7:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01018aa:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c01018ae:	66 89 10             	mov    %dx,(%eax)
        addr_6845 = CGA_BASE;
c01018b1:	66 c7 05 26 15 1b c0 	movw   $0x3d4,0xc01b1526
c01018b8:	d4 03 
    }

    // Extract cursor location
    uint32_t pos;
    outb(addr_6845, 14);
c01018ba:	0f b7 05 26 15 1b c0 	movzwl 0xc01b1526,%eax
c01018c1:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
c01018c5:	c6 45 e5 0e          	movb   $0xe,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01018c9:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01018cd:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01018d1:	ee                   	out    %al,(%dx)
}
c01018d2:	90                   	nop
    pos = inb(addr_6845 + 1) << 8;
c01018d3:	0f b7 05 26 15 1b c0 	movzwl 0xc01b1526,%eax
c01018da:	40                   	inc    %eax
c01018db:	0f b7 c0             	movzwl %ax,%eax
c01018de:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01018e2:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01018e6:	89 c2                	mov    %eax,%edx
c01018e8:	ec                   	in     (%dx),%al
c01018e9:	88 45 e9             	mov    %al,-0x17(%ebp)
    return data;
c01018ec:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01018f0:	0f b6 c0             	movzbl %al,%eax
c01018f3:	c1 e0 08             	shl    $0x8,%eax
c01018f6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    outb(addr_6845, 15);
c01018f9:	0f b7 05 26 15 1b c0 	movzwl 0xc01b1526,%eax
c0101900:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101904:	c6 45 ed 0f          	movb   $0xf,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101908:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c010190c:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101910:	ee                   	out    %al,(%dx)
}
c0101911:	90                   	nop
    pos |= inb(addr_6845 + 1);
c0101912:	0f b7 05 26 15 1b c0 	movzwl 0xc01b1526,%eax
c0101919:	40                   	inc    %eax
c010191a:	0f b7 c0             	movzwl %ax,%eax
c010191d:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101921:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101925:	89 c2                	mov    %eax,%edx
c0101927:	ec                   	in     (%dx),%al
c0101928:	88 45 f1             	mov    %al,-0xf(%ebp)
    return data;
c010192b:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c010192f:	0f b6 c0             	movzbl %al,%eax
c0101932:	09 45 f4             	or     %eax,-0xc(%ebp)

    crt_buf = (uint16_t*) cp;
c0101935:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101938:	a3 20 15 1b c0       	mov    %eax,0xc01b1520
    crt_pos = pos;
c010193d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101940:	0f b7 c0             	movzwl %ax,%eax
c0101943:	66 a3 24 15 1b c0    	mov    %ax,0xc01b1524
}
c0101949:	90                   	nop
c010194a:	c9                   	leave  
c010194b:	c3                   	ret    

c010194c <serial_init>:

static bool serial_exists = 0;

static void
serial_init(void) {
c010194c:	f3 0f 1e fb          	endbr32 
c0101950:	55                   	push   %ebp
c0101951:	89 e5                	mov    %esp,%ebp
c0101953:	83 ec 48             	sub    $0x48,%esp
c0101956:	66 c7 45 d2 fa 03    	movw   $0x3fa,-0x2e(%ebp)
c010195c:	c6 45 d1 00          	movb   $0x0,-0x2f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101960:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0101964:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c0101968:	ee                   	out    %al,(%dx)
}
c0101969:	90                   	nop
c010196a:	66 c7 45 d6 fb 03    	movw   $0x3fb,-0x2a(%ebp)
c0101970:	c6 45 d5 80          	movb   $0x80,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101974:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101978:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c010197c:	ee                   	out    %al,(%dx)
}
c010197d:	90                   	nop
c010197e:	66 c7 45 da f8 03    	movw   $0x3f8,-0x26(%ebp)
c0101984:	c6 45 d9 0c          	movb   $0xc,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101988:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c010198c:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101990:	ee                   	out    %al,(%dx)
}
c0101991:	90                   	nop
c0101992:	66 c7 45 de f9 03    	movw   $0x3f9,-0x22(%ebp)
c0101998:	c6 45 dd 00          	movb   $0x0,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010199c:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c01019a0:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c01019a4:	ee                   	out    %al,(%dx)
}
c01019a5:	90                   	nop
c01019a6:	66 c7 45 e2 fb 03    	movw   $0x3fb,-0x1e(%ebp)
c01019ac:	c6 45 e1 03          	movb   $0x3,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01019b0:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c01019b4:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c01019b8:	ee                   	out    %al,(%dx)
}
c01019b9:	90                   	nop
c01019ba:	66 c7 45 e6 fc 03    	movw   $0x3fc,-0x1a(%ebp)
c01019c0:	c6 45 e5 00          	movb   $0x0,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01019c4:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01019c8:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01019cc:	ee                   	out    %al,(%dx)
}
c01019cd:	90                   	nop
c01019ce:	66 c7 45 ea f9 03    	movw   $0x3f9,-0x16(%ebp)
c01019d4:	c6 45 e9 01          	movb   $0x1,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01019d8:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01019dc:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01019e0:	ee                   	out    %al,(%dx)
}
c01019e1:	90                   	nop
c01019e2:	66 c7 45 ee fd 03    	movw   $0x3fd,-0x12(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01019e8:	0f b7 45 ee          	movzwl -0x12(%ebp),%eax
c01019ec:	89 c2                	mov    %eax,%edx
c01019ee:	ec                   	in     (%dx),%al
c01019ef:	88 45 ed             	mov    %al,-0x13(%ebp)
    return data;
c01019f2:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
    // Enable rcv interrupts
    outb(COM1 + COM_IER, COM_IER_RDI);

    // Clear any preexisting overrun indications and interrupts
    // Serial port doesn't exist if COM_LSR returns 0xFF
    serial_exists = (inb(COM1 + COM_LSR) != 0xFF);
c01019f6:	3c ff                	cmp    $0xff,%al
c01019f8:	0f 95 c0             	setne  %al
c01019fb:	0f b6 c0             	movzbl %al,%eax
c01019fe:	a3 28 15 1b c0       	mov    %eax,0xc01b1528
c0101a03:	66 c7 45 f2 fa 03    	movw   $0x3fa,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101a09:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101a0d:	89 c2                	mov    %eax,%edx
c0101a0f:	ec                   	in     (%dx),%al
c0101a10:	88 45 f1             	mov    %al,-0xf(%ebp)
c0101a13:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c0101a19:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101a1d:	89 c2                	mov    %eax,%edx
c0101a1f:	ec                   	in     (%dx),%al
c0101a20:	88 45 f5             	mov    %al,-0xb(%ebp)
    (void) inb(COM1+COM_IIR);
    (void) inb(COM1+COM_RX);

    if (serial_exists) {
c0101a23:	a1 28 15 1b c0       	mov    0xc01b1528,%eax
c0101a28:	85 c0                	test   %eax,%eax
c0101a2a:	74 0c                	je     c0101a38 <serial_init+0xec>
        pic_enable(IRQ_COM1);
c0101a2c:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c0101a33:	e8 31 07 00 00       	call   c0102169 <pic_enable>
    }
}
c0101a38:	90                   	nop
c0101a39:	c9                   	leave  
c0101a3a:	c3                   	ret    

c0101a3b <lpt_putc_sub>:

static void
lpt_putc_sub(int c) {
c0101a3b:	f3 0f 1e fb          	endbr32 
c0101a3f:	55                   	push   %ebp
c0101a40:	89 e5                	mov    %esp,%ebp
c0101a42:	83 ec 20             	sub    $0x20,%esp
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0101a45:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0101a4c:	eb 08                	jmp    c0101a56 <lpt_putc_sub+0x1b>
        delay();
c0101a4e:	e8 c2 fd ff ff       	call   c0101815 <delay>
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0101a53:	ff 45 fc             	incl   -0x4(%ebp)
c0101a56:	66 c7 45 fa 79 03    	movw   $0x379,-0x6(%ebp)
c0101a5c:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101a60:	89 c2                	mov    %eax,%edx
c0101a62:	ec                   	in     (%dx),%al
c0101a63:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101a66:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101a6a:	84 c0                	test   %al,%al
c0101a6c:	78 09                	js     c0101a77 <lpt_putc_sub+0x3c>
c0101a6e:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0101a75:	7e d7                	jle    c0101a4e <lpt_putc_sub+0x13>
    }
    outb(LPTPORT + 0, c);
c0101a77:	8b 45 08             	mov    0x8(%ebp),%eax
c0101a7a:	0f b6 c0             	movzbl %al,%eax
c0101a7d:	66 c7 45 ee 78 03    	movw   $0x378,-0x12(%ebp)
c0101a83:	88 45 ed             	mov    %al,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101a86:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101a8a:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101a8e:	ee                   	out    %al,(%dx)
}
c0101a8f:	90                   	nop
c0101a90:	66 c7 45 f2 7a 03    	movw   $0x37a,-0xe(%ebp)
c0101a96:	c6 45 f1 0d          	movb   $0xd,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101a9a:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101a9e:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101aa2:	ee                   	out    %al,(%dx)
}
c0101aa3:	90                   	nop
c0101aa4:	66 c7 45 f6 7a 03    	movw   $0x37a,-0xa(%ebp)
c0101aaa:	c6 45 f5 08          	movb   $0x8,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101aae:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101ab2:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101ab6:	ee                   	out    %al,(%dx)
}
c0101ab7:	90                   	nop
    outb(LPTPORT + 2, 0x08 | 0x04 | 0x01);
    outb(LPTPORT + 2, 0x08);
}
c0101ab8:	90                   	nop
c0101ab9:	c9                   	leave  
c0101aba:	c3                   	ret    

c0101abb <lpt_putc>:

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
c0101abb:	f3 0f 1e fb          	endbr32 
c0101abf:	55                   	push   %ebp
c0101ac0:	89 e5                	mov    %esp,%ebp
c0101ac2:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c0101ac5:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0101ac9:	74 0d                	je     c0101ad8 <lpt_putc+0x1d>
        lpt_putc_sub(c);
c0101acb:	8b 45 08             	mov    0x8(%ebp),%eax
c0101ace:	89 04 24             	mov    %eax,(%esp)
c0101ad1:	e8 65 ff ff ff       	call   c0101a3b <lpt_putc_sub>
    else {
        lpt_putc_sub('\b');
        lpt_putc_sub(' ');
        lpt_putc_sub('\b');
    }
}
c0101ad6:	eb 24                	jmp    c0101afc <lpt_putc+0x41>
        lpt_putc_sub('\b');
c0101ad8:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101adf:	e8 57 ff ff ff       	call   c0101a3b <lpt_putc_sub>
        lpt_putc_sub(' ');
c0101ae4:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0101aeb:	e8 4b ff ff ff       	call   c0101a3b <lpt_putc_sub>
        lpt_putc_sub('\b');
c0101af0:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101af7:	e8 3f ff ff ff       	call   c0101a3b <lpt_putc_sub>
}
c0101afc:	90                   	nop
c0101afd:	c9                   	leave  
c0101afe:	c3                   	ret    

c0101aff <cga_putc>:

/* cga_putc - print character to console */
static void
cga_putc(int c) {
c0101aff:	f3 0f 1e fb          	endbr32 
c0101b03:	55                   	push   %ebp
c0101b04:	89 e5                	mov    %esp,%ebp
c0101b06:	53                   	push   %ebx
c0101b07:	83 ec 34             	sub    $0x34,%esp
    // set black on white
    if (!(c & ~0xFF)) {
c0101b0a:	8b 45 08             	mov    0x8(%ebp),%eax
c0101b0d:	25 00 ff ff ff       	and    $0xffffff00,%eax
c0101b12:	85 c0                	test   %eax,%eax
c0101b14:	75 07                	jne    c0101b1d <cga_putc+0x1e>
        c |= 0x0700;
c0101b16:	81 4d 08 00 07 00 00 	orl    $0x700,0x8(%ebp)
    }

    switch (c & 0xff) {
c0101b1d:	8b 45 08             	mov    0x8(%ebp),%eax
c0101b20:	0f b6 c0             	movzbl %al,%eax
c0101b23:	83 f8 0d             	cmp    $0xd,%eax
c0101b26:	74 72                	je     c0101b9a <cga_putc+0x9b>
c0101b28:	83 f8 0d             	cmp    $0xd,%eax
c0101b2b:	0f 8f a3 00 00 00    	jg     c0101bd4 <cga_putc+0xd5>
c0101b31:	83 f8 08             	cmp    $0x8,%eax
c0101b34:	74 0a                	je     c0101b40 <cga_putc+0x41>
c0101b36:	83 f8 0a             	cmp    $0xa,%eax
c0101b39:	74 4c                	je     c0101b87 <cga_putc+0x88>
c0101b3b:	e9 94 00 00 00       	jmp    c0101bd4 <cga_putc+0xd5>
    case '\b':
        if (crt_pos > 0) {
c0101b40:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101b47:	85 c0                	test   %eax,%eax
c0101b49:	0f 84 af 00 00 00    	je     c0101bfe <cga_putc+0xff>
            crt_pos --;
c0101b4f:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101b56:	48                   	dec    %eax
c0101b57:	0f b7 c0             	movzwl %ax,%eax
c0101b5a:	66 a3 24 15 1b c0    	mov    %ax,0xc01b1524
            crt_buf[crt_pos] = (c & ~0xff) | ' ';
c0101b60:	8b 45 08             	mov    0x8(%ebp),%eax
c0101b63:	98                   	cwtl   
c0101b64:	25 00 ff ff ff       	and    $0xffffff00,%eax
c0101b69:	98                   	cwtl   
c0101b6a:	83 c8 20             	or     $0x20,%eax
c0101b6d:	98                   	cwtl   
c0101b6e:	8b 15 20 15 1b c0    	mov    0xc01b1520,%edx
c0101b74:	0f b7 0d 24 15 1b c0 	movzwl 0xc01b1524,%ecx
c0101b7b:	01 c9                	add    %ecx,%ecx
c0101b7d:	01 ca                	add    %ecx,%edx
c0101b7f:	0f b7 c0             	movzwl %ax,%eax
c0101b82:	66 89 02             	mov    %ax,(%edx)
        }
        break;
c0101b85:	eb 77                	jmp    c0101bfe <cga_putc+0xff>
    case '\n':
        crt_pos += CRT_COLS;
c0101b87:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101b8e:	83 c0 50             	add    $0x50,%eax
c0101b91:	0f b7 c0             	movzwl %ax,%eax
c0101b94:	66 a3 24 15 1b c0    	mov    %ax,0xc01b1524
    case '\r':
        crt_pos -= (crt_pos % CRT_COLS);
c0101b9a:	0f b7 1d 24 15 1b c0 	movzwl 0xc01b1524,%ebx
c0101ba1:	0f b7 0d 24 15 1b c0 	movzwl 0xc01b1524,%ecx
c0101ba8:	ba cd cc cc cc       	mov    $0xcccccccd,%edx
c0101bad:	89 c8                	mov    %ecx,%eax
c0101baf:	f7 e2                	mul    %edx
c0101bb1:	c1 ea 06             	shr    $0x6,%edx
c0101bb4:	89 d0                	mov    %edx,%eax
c0101bb6:	c1 e0 02             	shl    $0x2,%eax
c0101bb9:	01 d0                	add    %edx,%eax
c0101bbb:	c1 e0 04             	shl    $0x4,%eax
c0101bbe:	29 c1                	sub    %eax,%ecx
c0101bc0:	89 c8                	mov    %ecx,%eax
c0101bc2:	0f b7 c0             	movzwl %ax,%eax
c0101bc5:	29 c3                	sub    %eax,%ebx
c0101bc7:	89 d8                	mov    %ebx,%eax
c0101bc9:	0f b7 c0             	movzwl %ax,%eax
c0101bcc:	66 a3 24 15 1b c0    	mov    %ax,0xc01b1524
        break;
c0101bd2:	eb 2b                	jmp    c0101bff <cga_putc+0x100>
    default:
        crt_buf[crt_pos ++] = c;     // write the character
c0101bd4:	8b 0d 20 15 1b c0    	mov    0xc01b1520,%ecx
c0101bda:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101be1:	8d 50 01             	lea    0x1(%eax),%edx
c0101be4:	0f b7 d2             	movzwl %dx,%edx
c0101be7:	66 89 15 24 15 1b c0 	mov    %dx,0xc01b1524
c0101bee:	01 c0                	add    %eax,%eax
c0101bf0:	8d 14 01             	lea    (%ecx,%eax,1),%edx
c0101bf3:	8b 45 08             	mov    0x8(%ebp),%eax
c0101bf6:	0f b7 c0             	movzwl %ax,%eax
c0101bf9:	66 89 02             	mov    %ax,(%edx)
        break;
c0101bfc:	eb 01                	jmp    c0101bff <cga_putc+0x100>
        break;
c0101bfe:	90                   	nop
    }

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
c0101bff:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101c06:	3d cf 07 00 00       	cmp    $0x7cf,%eax
c0101c0b:	76 5d                	jbe    c0101c6a <cga_putc+0x16b>
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
c0101c0d:	a1 20 15 1b c0       	mov    0xc01b1520,%eax
c0101c12:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
c0101c18:	a1 20 15 1b c0       	mov    0xc01b1520,%eax
c0101c1d:	c7 44 24 08 00 0f 00 	movl   $0xf00,0x8(%esp)
c0101c24:	00 
c0101c25:	89 54 24 04          	mov    %edx,0x4(%esp)
c0101c29:	89 04 24             	mov    %eax,(%esp)
c0101c2c:	e8 3f 9c 00 00       	call   c010b870 <memmove>
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101c31:	c7 45 f4 80 07 00 00 	movl   $0x780,-0xc(%ebp)
c0101c38:	eb 14                	jmp    c0101c4e <cga_putc+0x14f>
            crt_buf[i] = 0x0700 | ' ';
c0101c3a:	a1 20 15 1b c0       	mov    0xc01b1520,%eax
c0101c3f:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101c42:	01 d2                	add    %edx,%edx
c0101c44:	01 d0                	add    %edx,%eax
c0101c46:	66 c7 00 20 07       	movw   $0x720,(%eax)
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101c4b:	ff 45 f4             	incl   -0xc(%ebp)
c0101c4e:	81 7d f4 cf 07 00 00 	cmpl   $0x7cf,-0xc(%ebp)
c0101c55:	7e e3                	jle    c0101c3a <cga_putc+0x13b>
        }
        crt_pos -= CRT_COLS;
c0101c57:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101c5e:	83 e8 50             	sub    $0x50,%eax
c0101c61:	0f b7 c0             	movzwl %ax,%eax
c0101c64:	66 a3 24 15 1b c0    	mov    %ax,0xc01b1524
    }

    // move that little blinky thing
    outb(addr_6845, 14);
c0101c6a:	0f b7 05 26 15 1b c0 	movzwl 0xc01b1526,%eax
c0101c71:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
c0101c75:	c6 45 e5 0e          	movb   $0xe,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101c79:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101c7d:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101c81:	ee                   	out    %al,(%dx)
}
c0101c82:	90                   	nop
    outb(addr_6845 + 1, crt_pos >> 8);
c0101c83:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101c8a:	c1 e8 08             	shr    $0x8,%eax
c0101c8d:	0f b7 c0             	movzwl %ax,%eax
c0101c90:	0f b6 c0             	movzbl %al,%eax
c0101c93:	0f b7 15 26 15 1b c0 	movzwl 0xc01b1526,%edx
c0101c9a:	42                   	inc    %edx
c0101c9b:	0f b7 d2             	movzwl %dx,%edx
c0101c9e:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101ca2:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101ca5:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101ca9:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101cad:	ee                   	out    %al,(%dx)
}
c0101cae:	90                   	nop
    outb(addr_6845, 15);
c0101caf:	0f b7 05 26 15 1b c0 	movzwl 0xc01b1526,%eax
c0101cb6:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101cba:	c6 45 ed 0f          	movb   $0xf,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101cbe:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101cc2:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101cc6:	ee                   	out    %al,(%dx)
}
c0101cc7:	90                   	nop
    outb(addr_6845 + 1, crt_pos);
c0101cc8:	0f b7 05 24 15 1b c0 	movzwl 0xc01b1524,%eax
c0101ccf:	0f b6 c0             	movzbl %al,%eax
c0101cd2:	0f b7 15 26 15 1b c0 	movzwl 0xc01b1526,%edx
c0101cd9:	42                   	inc    %edx
c0101cda:	0f b7 d2             	movzwl %dx,%edx
c0101cdd:	66 89 55 f2          	mov    %dx,-0xe(%ebp)
c0101ce1:	88 45 f1             	mov    %al,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101ce4:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101ce8:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101cec:	ee                   	out    %al,(%dx)
}
c0101ced:	90                   	nop
}
c0101cee:	90                   	nop
c0101cef:	83 c4 34             	add    $0x34,%esp
c0101cf2:	5b                   	pop    %ebx
c0101cf3:	5d                   	pop    %ebp
c0101cf4:	c3                   	ret    

c0101cf5 <serial_putc_sub>:

static void
serial_putc_sub(int c) {
c0101cf5:	f3 0f 1e fb          	endbr32 
c0101cf9:	55                   	push   %ebp
c0101cfa:	89 e5                	mov    %esp,%ebp
c0101cfc:	83 ec 10             	sub    $0x10,%esp
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101cff:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0101d06:	eb 08                	jmp    c0101d10 <serial_putc_sub+0x1b>
        delay();
c0101d08:	e8 08 fb ff ff       	call   c0101815 <delay>
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101d0d:	ff 45 fc             	incl   -0x4(%ebp)
c0101d10:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101d16:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101d1a:	89 c2                	mov    %eax,%edx
c0101d1c:	ec                   	in     (%dx),%al
c0101d1d:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101d20:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101d24:	0f b6 c0             	movzbl %al,%eax
c0101d27:	83 e0 20             	and    $0x20,%eax
c0101d2a:	85 c0                	test   %eax,%eax
c0101d2c:	75 09                	jne    c0101d37 <serial_putc_sub+0x42>
c0101d2e:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0101d35:	7e d1                	jle    c0101d08 <serial_putc_sub+0x13>
    }
    outb(COM1 + COM_TX, c);
c0101d37:	8b 45 08             	mov    0x8(%ebp),%eax
c0101d3a:	0f b6 c0             	movzbl %al,%eax
c0101d3d:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c0101d43:	88 45 f5             	mov    %al,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101d46:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101d4a:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101d4e:	ee                   	out    %al,(%dx)
}
c0101d4f:	90                   	nop
}
c0101d50:	90                   	nop
c0101d51:	c9                   	leave  
c0101d52:	c3                   	ret    

c0101d53 <serial_putc>:

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
c0101d53:	f3 0f 1e fb          	endbr32 
c0101d57:	55                   	push   %ebp
c0101d58:	89 e5                	mov    %esp,%ebp
c0101d5a:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c0101d5d:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0101d61:	74 0d                	je     c0101d70 <serial_putc+0x1d>
        serial_putc_sub(c);
c0101d63:	8b 45 08             	mov    0x8(%ebp),%eax
c0101d66:	89 04 24             	mov    %eax,(%esp)
c0101d69:	e8 87 ff ff ff       	call   c0101cf5 <serial_putc_sub>
    else {
        serial_putc_sub('\b');
        serial_putc_sub(' ');
        serial_putc_sub('\b');
    }
}
c0101d6e:	eb 24                	jmp    c0101d94 <serial_putc+0x41>
        serial_putc_sub('\b');
c0101d70:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101d77:	e8 79 ff ff ff       	call   c0101cf5 <serial_putc_sub>
        serial_putc_sub(' ');
c0101d7c:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0101d83:	e8 6d ff ff ff       	call   c0101cf5 <serial_putc_sub>
        serial_putc_sub('\b');
c0101d88:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101d8f:	e8 61 ff ff ff       	call   c0101cf5 <serial_putc_sub>
}
c0101d94:	90                   	nop
c0101d95:	c9                   	leave  
c0101d96:	c3                   	ret    

c0101d97 <cons_intr>:
/* *
 * cons_intr - called by device interrupt routines to feed input
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
c0101d97:	f3 0f 1e fb          	endbr32 
c0101d9b:	55                   	push   %ebp
c0101d9c:	89 e5                	mov    %esp,%ebp
c0101d9e:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = (*proc)()) != -1) {
c0101da1:	eb 33                	jmp    c0101dd6 <cons_intr+0x3f>
        if (c != 0) {
c0101da3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101da7:	74 2d                	je     c0101dd6 <cons_intr+0x3f>
            cons.buf[cons.wpos ++] = c;
c0101da9:	a1 44 17 1b c0       	mov    0xc01b1744,%eax
c0101dae:	8d 50 01             	lea    0x1(%eax),%edx
c0101db1:	89 15 44 17 1b c0    	mov    %edx,0xc01b1744
c0101db7:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101dba:	88 90 40 15 1b c0    	mov    %dl,-0x3fe4eac0(%eax)
            if (cons.wpos == CONSBUFSIZE) {
c0101dc0:	a1 44 17 1b c0       	mov    0xc01b1744,%eax
c0101dc5:	3d 00 02 00 00       	cmp    $0x200,%eax
c0101dca:	75 0a                	jne    c0101dd6 <cons_intr+0x3f>
                cons.wpos = 0;
c0101dcc:	c7 05 44 17 1b c0 00 	movl   $0x0,0xc01b1744
c0101dd3:	00 00 00 
    while ((c = (*proc)()) != -1) {
c0101dd6:	8b 45 08             	mov    0x8(%ebp),%eax
c0101dd9:	ff d0                	call   *%eax
c0101ddb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101dde:	83 7d f4 ff          	cmpl   $0xffffffff,-0xc(%ebp)
c0101de2:	75 bf                	jne    c0101da3 <cons_intr+0xc>
            }
        }
    }
}
c0101de4:	90                   	nop
c0101de5:	90                   	nop
c0101de6:	c9                   	leave  
c0101de7:	c3                   	ret    

c0101de8 <serial_proc_data>:

/* serial_proc_data - get data from serial port */
static int
serial_proc_data(void) {
c0101de8:	f3 0f 1e fb          	endbr32 
c0101dec:	55                   	push   %ebp
c0101ded:	89 e5                	mov    %esp,%ebp
c0101def:	83 ec 10             	sub    $0x10,%esp
c0101df2:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101df8:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101dfc:	89 c2                	mov    %eax,%edx
c0101dfe:	ec                   	in     (%dx),%al
c0101dff:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101e02:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
    if (!(inb(COM1 + COM_LSR) & COM_LSR_DATA)) {
c0101e06:	0f b6 c0             	movzbl %al,%eax
c0101e09:	83 e0 01             	and    $0x1,%eax
c0101e0c:	85 c0                	test   %eax,%eax
c0101e0e:	75 07                	jne    c0101e17 <serial_proc_data+0x2f>
        return -1;
c0101e10:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101e15:	eb 2a                	jmp    c0101e41 <serial_proc_data+0x59>
c0101e17:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101e1d:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101e21:	89 c2                	mov    %eax,%edx
c0101e23:	ec                   	in     (%dx),%al
c0101e24:	88 45 f5             	mov    %al,-0xb(%ebp)
    return data;
c0101e27:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
    }
    int c = inb(COM1 + COM_RX);
c0101e2b:	0f b6 c0             	movzbl %al,%eax
c0101e2e:	89 45 fc             	mov    %eax,-0x4(%ebp)
    if (c == 127) {
c0101e31:	83 7d fc 7f          	cmpl   $0x7f,-0x4(%ebp)
c0101e35:	75 07                	jne    c0101e3e <serial_proc_data+0x56>
        c = '\b';
c0101e37:	c7 45 fc 08 00 00 00 	movl   $0x8,-0x4(%ebp)
    }
    return c;
c0101e3e:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0101e41:	c9                   	leave  
c0101e42:	c3                   	ret    

c0101e43 <serial_intr>:

/* serial_intr - try to feed input characters from serial port */
void
serial_intr(void) {
c0101e43:	f3 0f 1e fb          	endbr32 
c0101e47:	55                   	push   %ebp
c0101e48:	89 e5                	mov    %esp,%ebp
c0101e4a:	83 ec 18             	sub    $0x18,%esp
    if (serial_exists) {
c0101e4d:	a1 28 15 1b c0       	mov    0xc01b1528,%eax
c0101e52:	85 c0                	test   %eax,%eax
c0101e54:	74 0c                	je     c0101e62 <serial_intr+0x1f>
        cons_intr(serial_proc_data);
c0101e56:	c7 04 24 e8 1d 10 c0 	movl   $0xc0101de8,(%esp)
c0101e5d:	e8 35 ff ff ff       	call   c0101d97 <cons_intr>
    }
}
c0101e62:	90                   	nop
c0101e63:	c9                   	leave  
c0101e64:	c3                   	ret    

c0101e65 <kbd_proc_data>:
 *
 * The kbd_proc_data() function gets data from the keyboard.
 * If we finish a character, return it, else 0. And return -1 if no data.
 * */
static int
kbd_proc_data(void) {
c0101e65:	f3 0f 1e fb          	endbr32 
c0101e69:	55                   	push   %ebp
c0101e6a:	89 e5                	mov    %esp,%ebp
c0101e6c:	83 ec 38             	sub    $0x38,%esp
c0101e6f:	66 c7 45 f0 64 00    	movw   $0x64,-0x10(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101e75:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101e78:	89 c2                	mov    %eax,%edx
c0101e7a:	ec                   	in     (%dx),%al
c0101e7b:	88 45 ef             	mov    %al,-0x11(%ebp)
    return data;
c0101e7e:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
    int c;
    uint8_t data;
    static uint32_t shift;

    if ((inb(KBSTATP) & KBS_DIB) == 0) {
c0101e82:	0f b6 c0             	movzbl %al,%eax
c0101e85:	83 e0 01             	and    $0x1,%eax
c0101e88:	85 c0                	test   %eax,%eax
c0101e8a:	75 0a                	jne    c0101e96 <kbd_proc_data+0x31>
        return -1;
c0101e8c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101e91:	e9 56 01 00 00       	jmp    c0101fec <kbd_proc_data+0x187>
c0101e96:	66 c7 45 ec 60 00    	movw   $0x60,-0x14(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101e9c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101e9f:	89 c2                	mov    %eax,%edx
c0101ea1:	ec                   	in     (%dx),%al
c0101ea2:	88 45 eb             	mov    %al,-0x15(%ebp)
    return data;
c0101ea5:	0f b6 45 eb          	movzbl -0x15(%ebp),%eax
    }

    data = inb(KBDATAP);
c0101ea9:	88 45 f3             	mov    %al,-0xd(%ebp)

    if (data == 0xE0) {
c0101eac:	80 7d f3 e0          	cmpb   $0xe0,-0xd(%ebp)
c0101eb0:	75 17                	jne    c0101ec9 <kbd_proc_data+0x64>
        // E0 escape character
        shift |= E0ESC;
c0101eb2:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101eb7:	83 c8 40             	or     $0x40,%eax
c0101eba:	a3 48 17 1b c0       	mov    %eax,0xc01b1748
        return 0;
c0101ebf:	b8 00 00 00 00       	mov    $0x0,%eax
c0101ec4:	e9 23 01 00 00       	jmp    c0101fec <kbd_proc_data+0x187>
    } else if (data & 0x80) {
c0101ec9:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101ecd:	84 c0                	test   %al,%al
c0101ecf:	79 45                	jns    c0101f16 <kbd_proc_data+0xb1>
        // Key released
        data = (shift & E0ESC ? data : data & 0x7F);
c0101ed1:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101ed6:	83 e0 40             	and    $0x40,%eax
c0101ed9:	85 c0                	test   %eax,%eax
c0101edb:	75 08                	jne    c0101ee5 <kbd_proc_data+0x80>
c0101edd:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101ee1:	24 7f                	and    $0x7f,%al
c0101ee3:	eb 04                	jmp    c0101ee9 <kbd_proc_data+0x84>
c0101ee5:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101ee9:	88 45 f3             	mov    %al,-0xd(%ebp)
        shift &= ~(shiftcode[data] | E0ESC);
c0101eec:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101ef0:	0f b6 80 40 e0 12 c0 	movzbl -0x3fed1fc0(%eax),%eax
c0101ef7:	0c 40                	or     $0x40,%al
c0101ef9:	0f b6 c0             	movzbl %al,%eax
c0101efc:	f7 d0                	not    %eax
c0101efe:	89 c2                	mov    %eax,%edx
c0101f00:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101f05:	21 d0                	and    %edx,%eax
c0101f07:	a3 48 17 1b c0       	mov    %eax,0xc01b1748
        return 0;
c0101f0c:	b8 00 00 00 00       	mov    $0x0,%eax
c0101f11:	e9 d6 00 00 00       	jmp    c0101fec <kbd_proc_data+0x187>
    } else if (shift & E0ESC) {
c0101f16:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101f1b:	83 e0 40             	and    $0x40,%eax
c0101f1e:	85 c0                	test   %eax,%eax
c0101f20:	74 11                	je     c0101f33 <kbd_proc_data+0xce>
        // Last character was an E0 escape; or with 0x80
        data |= 0x80;
c0101f22:	80 4d f3 80          	orb    $0x80,-0xd(%ebp)
        shift &= ~E0ESC;
c0101f26:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101f2b:	83 e0 bf             	and    $0xffffffbf,%eax
c0101f2e:	a3 48 17 1b c0       	mov    %eax,0xc01b1748
    }

    shift |= shiftcode[data];
c0101f33:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101f37:	0f b6 80 40 e0 12 c0 	movzbl -0x3fed1fc0(%eax),%eax
c0101f3e:	0f b6 d0             	movzbl %al,%edx
c0101f41:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101f46:	09 d0                	or     %edx,%eax
c0101f48:	a3 48 17 1b c0       	mov    %eax,0xc01b1748
    shift ^= togglecode[data];
c0101f4d:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101f51:	0f b6 80 40 e1 12 c0 	movzbl -0x3fed1ec0(%eax),%eax
c0101f58:	0f b6 d0             	movzbl %al,%edx
c0101f5b:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101f60:	31 d0                	xor    %edx,%eax
c0101f62:	a3 48 17 1b c0       	mov    %eax,0xc01b1748

    c = charcode[shift & (CTL | SHIFT)][data];
c0101f67:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101f6c:	83 e0 03             	and    $0x3,%eax
c0101f6f:	8b 14 85 40 e5 12 c0 	mov    -0x3fed1ac0(,%eax,4),%edx
c0101f76:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101f7a:	01 d0                	add    %edx,%eax
c0101f7c:	0f b6 00             	movzbl (%eax),%eax
c0101f7f:	0f b6 c0             	movzbl %al,%eax
c0101f82:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (shift & CAPSLOCK) {
c0101f85:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101f8a:	83 e0 08             	and    $0x8,%eax
c0101f8d:	85 c0                	test   %eax,%eax
c0101f8f:	74 22                	je     c0101fb3 <kbd_proc_data+0x14e>
        if ('a' <= c && c <= 'z')
c0101f91:	83 7d f4 60          	cmpl   $0x60,-0xc(%ebp)
c0101f95:	7e 0c                	jle    c0101fa3 <kbd_proc_data+0x13e>
c0101f97:	83 7d f4 7a          	cmpl   $0x7a,-0xc(%ebp)
c0101f9b:	7f 06                	jg     c0101fa3 <kbd_proc_data+0x13e>
            c += 'A' - 'a';
c0101f9d:	83 6d f4 20          	subl   $0x20,-0xc(%ebp)
c0101fa1:	eb 10                	jmp    c0101fb3 <kbd_proc_data+0x14e>
        else if ('A' <= c && c <= 'Z')
c0101fa3:	83 7d f4 40          	cmpl   $0x40,-0xc(%ebp)
c0101fa7:	7e 0a                	jle    c0101fb3 <kbd_proc_data+0x14e>
c0101fa9:	83 7d f4 5a          	cmpl   $0x5a,-0xc(%ebp)
c0101fad:	7f 04                	jg     c0101fb3 <kbd_proc_data+0x14e>
            c += 'a' - 'A';
c0101faf:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
    }

    // Process special keys
    // Ctrl-Alt-Del: reboot
    if (!(~shift & (CTL | ALT)) && c == KEY_DEL) {
c0101fb3:	a1 48 17 1b c0       	mov    0xc01b1748,%eax
c0101fb8:	f7 d0                	not    %eax
c0101fba:	83 e0 06             	and    $0x6,%eax
c0101fbd:	85 c0                	test   %eax,%eax
c0101fbf:	75 28                	jne    c0101fe9 <kbd_proc_data+0x184>
c0101fc1:	81 7d f4 e9 00 00 00 	cmpl   $0xe9,-0xc(%ebp)
c0101fc8:	75 1f                	jne    c0101fe9 <kbd_proc_data+0x184>
        cprintf("Rebooting!\n");
c0101fca:	c7 04 24 81 c5 10 c0 	movl   $0xc010c581,(%esp)
c0101fd1:	e8 fb e2 ff ff       	call   c01002d1 <cprintf>
c0101fd6:	66 c7 45 e8 92 00    	movw   $0x92,-0x18(%ebp)
c0101fdc:	c6 45 e7 03          	movb   $0x3,-0x19(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101fe0:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
c0101fe4:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0101fe7:	ee                   	out    %al,(%dx)
}
c0101fe8:	90                   	nop
        outb(0x92, 0x3); // courtesy of Chris Frost
    }
    return c;
c0101fe9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101fec:	c9                   	leave  
c0101fed:	c3                   	ret    

c0101fee <kbd_intr>:

/* kbd_intr - try to feed input characters from keyboard */
static void
kbd_intr(void) {
c0101fee:	f3 0f 1e fb          	endbr32 
c0101ff2:	55                   	push   %ebp
c0101ff3:	89 e5                	mov    %esp,%ebp
c0101ff5:	83 ec 18             	sub    $0x18,%esp
    cons_intr(kbd_proc_data);
c0101ff8:	c7 04 24 65 1e 10 c0 	movl   $0xc0101e65,(%esp)
c0101fff:	e8 93 fd ff ff       	call   c0101d97 <cons_intr>
}
c0102004:	90                   	nop
c0102005:	c9                   	leave  
c0102006:	c3                   	ret    

c0102007 <kbd_init>:

static void
kbd_init(void) {
c0102007:	f3 0f 1e fb          	endbr32 
c010200b:	55                   	push   %ebp
c010200c:	89 e5                	mov    %esp,%ebp
c010200e:	83 ec 18             	sub    $0x18,%esp
    // drain the kbd buffer
    kbd_intr();
c0102011:	e8 d8 ff ff ff       	call   c0101fee <kbd_intr>
    pic_enable(IRQ_KBD);
c0102016:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010201d:	e8 47 01 00 00       	call   c0102169 <pic_enable>
}
c0102022:	90                   	nop
c0102023:	c9                   	leave  
c0102024:	c3                   	ret    

c0102025 <cons_init>:

/* cons_init - initializes the console devices */
void
cons_init(void) {
c0102025:	f3 0f 1e fb          	endbr32 
c0102029:	55                   	push   %ebp
c010202a:	89 e5                	mov    %esp,%ebp
c010202c:	83 ec 18             	sub    $0x18,%esp
    cga_init();
c010202f:	e8 2e f8 ff ff       	call   c0101862 <cga_init>
    serial_init();
c0102034:	e8 13 f9 ff ff       	call   c010194c <serial_init>
    kbd_init();
c0102039:	e8 c9 ff ff ff       	call   c0102007 <kbd_init>
    if (!serial_exists) {
c010203e:	a1 28 15 1b c0       	mov    0xc01b1528,%eax
c0102043:	85 c0                	test   %eax,%eax
c0102045:	75 0c                	jne    c0102053 <cons_init+0x2e>
        cprintf("serial port does not exist!!\n");
c0102047:	c7 04 24 8d c5 10 c0 	movl   $0xc010c58d,(%esp)
c010204e:	e8 7e e2 ff ff       	call   c01002d1 <cprintf>
    }
}
c0102053:	90                   	nop
c0102054:	c9                   	leave  
c0102055:	c3                   	ret    

c0102056 <cons_putc>:

/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
c0102056:	f3 0f 1e fb          	endbr32 
c010205a:	55                   	push   %ebp
c010205b:	89 e5                	mov    %esp,%ebp
c010205d:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c0102060:	e8 72 f7 ff ff       	call   c01017d7 <__intr_save>
c0102065:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        lpt_putc(c);
c0102068:	8b 45 08             	mov    0x8(%ebp),%eax
c010206b:	89 04 24             	mov    %eax,(%esp)
c010206e:	e8 48 fa ff ff       	call   c0101abb <lpt_putc>
        cga_putc(c);
c0102073:	8b 45 08             	mov    0x8(%ebp),%eax
c0102076:	89 04 24             	mov    %eax,(%esp)
c0102079:	e8 81 fa ff ff       	call   c0101aff <cga_putc>
        serial_putc(c);
c010207e:	8b 45 08             	mov    0x8(%ebp),%eax
c0102081:	89 04 24             	mov    %eax,(%esp)
c0102084:	e8 ca fc ff ff       	call   c0101d53 <serial_putc>
    }
    local_intr_restore(intr_flag);
c0102089:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010208c:	89 04 24             	mov    %eax,(%esp)
c010208f:	e8 6d f7 ff ff       	call   c0101801 <__intr_restore>
}
c0102094:	90                   	nop
c0102095:	c9                   	leave  
c0102096:	c3                   	ret    

c0102097 <cons_getc>:
/* *
 * cons_getc - return the next input character from console,
 * or 0 if none waiting.
 * */
int
cons_getc(void) {
c0102097:	f3 0f 1e fb          	endbr32 
c010209b:	55                   	push   %ebp
c010209c:	89 e5                	mov    %esp,%ebp
c010209e:	83 ec 28             	sub    $0x28,%esp
    int c = 0;
c01020a1:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    local_intr_save(intr_flag);
c01020a8:	e8 2a f7 ff ff       	call   c01017d7 <__intr_save>
c01020ad:	89 45 f0             	mov    %eax,-0x10(%ebp)
    {
        // poll for any pending input characters,
        // so that this function works even when interrupts are disabled
        // (e.g., when called from the kernel monitor).
        serial_intr();
c01020b0:	e8 8e fd ff ff       	call   c0101e43 <serial_intr>
        kbd_intr();
c01020b5:	e8 34 ff ff ff       	call   c0101fee <kbd_intr>

        // grab the next character from the input buffer.
        if (cons.rpos != cons.wpos) {
c01020ba:	8b 15 40 17 1b c0    	mov    0xc01b1740,%edx
c01020c0:	a1 44 17 1b c0       	mov    0xc01b1744,%eax
c01020c5:	39 c2                	cmp    %eax,%edx
c01020c7:	74 31                	je     c01020fa <cons_getc+0x63>
            c = cons.buf[cons.rpos ++];
c01020c9:	a1 40 17 1b c0       	mov    0xc01b1740,%eax
c01020ce:	8d 50 01             	lea    0x1(%eax),%edx
c01020d1:	89 15 40 17 1b c0    	mov    %edx,0xc01b1740
c01020d7:	0f b6 80 40 15 1b c0 	movzbl -0x3fe4eac0(%eax),%eax
c01020de:	0f b6 c0             	movzbl %al,%eax
c01020e1:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (cons.rpos == CONSBUFSIZE) {
c01020e4:	a1 40 17 1b c0       	mov    0xc01b1740,%eax
c01020e9:	3d 00 02 00 00       	cmp    $0x200,%eax
c01020ee:	75 0a                	jne    c01020fa <cons_getc+0x63>
                cons.rpos = 0;
c01020f0:	c7 05 40 17 1b c0 00 	movl   $0x0,0xc01b1740
c01020f7:	00 00 00 
            }
        }
    }
    local_intr_restore(intr_flag);
c01020fa:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01020fd:	89 04 24             	mov    %eax,(%esp)
c0102100:	e8 fc f6 ff ff       	call   c0101801 <__intr_restore>
    return c;
c0102105:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0102108:	c9                   	leave  
c0102109:	c3                   	ret    

c010210a <pic_setmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static uint16_t irq_mask = 0xFFFF & ~(1 << IRQ_SLAVE);
static bool did_init = 0;

static void
pic_setmask(uint16_t mask) {
c010210a:	f3 0f 1e fb          	endbr32 
c010210e:	55                   	push   %ebp
c010210f:	89 e5                	mov    %esp,%ebp
c0102111:	83 ec 14             	sub    $0x14,%esp
c0102114:	8b 45 08             	mov    0x8(%ebp),%eax
c0102117:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    irq_mask = mask;
c010211b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010211e:	66 a3 50 e5 12 c0    	mov    %ax,0xc012e550
    if (did_init) {
c0102124:	a1 4c 17 1b c0       	mov    0xc01b174c,%eax
c0102129:	85 c0                	test   %eax,%eax
c010212b:	74 39                	je     c0102166 <pic_setmask+0x5c>
        outb(IO_PIC1 + 1, mask);
c010212d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0102130:	0f b6 c0             	movzbl %al,%eax
c0102133:	66 c7 45 fa 21 00    	movw   $0x21,-0x6(%ebp)
c0102139:	88 45 f9             	mov    %al,-0x7(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010213c:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0102140:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0102144:	ee                   	out    %al,(%dx)
}
c0102145:	90                   	nop
        outb(IO_PIC2 + 1, mask >> 8);
c0102146:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c010214a:	c1 e8 08             	shr    $0x8,%eax
c010214d:	0f b7 c0             	movzwl %ax,%eax
c0102150:	0f b6 c0             	movzbl %al,%eax
c0102153:	66 c7 45 fe a1 00    	movw   $0xa1,-0x2(%ebp)
c0102159:	88 45 fd             	mov    %al,-0x3(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010215c:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0102160:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0102164:	ee                   	out    %al,(%dx)
}
c0102165:	90                   	nop
    }
}
c0102166:	90                   	nop
c0102167:	c9                   	leave  
c0102168:	c3                   	ret    

c0102169 <pic_enable>:

void
pic_enable(unsigned int irq) {
c0102169:	f3 0f 1e fb          	endbr32 
c010216d:	55                   	push   %ebp
c010216e:	89 e5                	mov    %esp,%ebp
c0102170:	83 ec 04             	sub    $0x4,%esp
    pic_setmask(irq_mask & ~(1 << irq));
c0102173:	8b 45 08             	mov    0x8(%ebp),%eax
c0102176:	ba 01 00 00 00       	mov    $0x1,%edx
c010217b:	88 c1                	mov    %al,%cl
c010217d:	d3 e2                	shl    %cl,%edx
c010217f:	89 d0                	mov    %edx,%eax
c0102181:	98                   	cwtl   
c0102182:	f7 d0                	not    %eax
c0102184:	0f bf d0             	movswl %ax,%edx
c0102187:	0f b7 05 50 e5 12 c0 	movzwl 0xc012e550,%eax
c010218e:	98                   	cwtl   
c010218f:	21 d0                	and    %edx,%eax
c0102191:	98                   	cwtl   
c0102192:	0f b7 c0             	movzwl %ax,%eax
c0102195:	89 04 24             	mov    %eax,(%esp)
c0102198:	e8 6d ff ff ff       	call   c010210a <pic_setmask>
}
c010219d:	90                   	nop
c010219e:	c9                   	leave  
c010219f:	c3                   	ret    

c01021a0 <pic_init>:

/* pic_init - initialize the 8259A interrupt controllers */
void
pic_init(void) {
c01021a0:	f3 0f 1e fb          	endbr32 
c01021a4:	55                   	push   %ebp
c01021a5:	89 e5                	mov    %esp,%ebp
c01021a7:	83 ec 44             	sub    $0x44,%esp
    did_init = 1;
c01021aa:	c7 05 4c 17 1b c0 01 	movl   $0x1,0xc01b174c
c01021b1:	00 00 00 
c01021b4:	66 c7 45 ca 21 00    	movw   $0x21,-0x36(%ebp)
c01021ba:	c6 45 c9 ff          	movb   $0xff,-0x37(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01021be:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c01021c2:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c01021c6:	ee                   	out    %al,(%dx)
}
c01021c7:	90                   	nop
c01021c8:	66 c7 45 ce a1 00    	movw   $0xa1,-0x32(%ebp)
c01021ce:	c6 45 cd ff          	movb   $0xff,-0x33(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01021d2:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c01021d6:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c01021da:	ee                   	out    %al,(%dx)
}
c01021db:	90                   	nop
c01021dc:	66 c7 45 d2 20 00    	movw   $0x20,-0x2e(%ebp)
c01021e2:	c6 45 d1 11          	movb   $0x11,-0x2f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01021e6:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c01021ea:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c01021ee:	ee                   	out    %al,(%dx)
}
c01021ef:	90                   	nop
c01021f0:	66 c7 45 d6 21 00    	movw   $0x21,-0x2a(%ebp)
c01021f6:	c6 45 d5 20          	movb   $0x20,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01021fa:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c01021fe:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0102202:	ee                   	out    %al,(%dx)
}
c0102203:	90                   	nop
c0102204:	66 c7 45 da 21 00    	movw   $0x21,-0x26(%ebp)
c010220a:	c6 45 d9 04          	movb   $0x4,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010220e:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0102212:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0102216:	ee                   	out    %al,(%dx)
}
c0102217:	90                   	nop
c0102218:	66 c7 45 de 21 00    	movw   $0x21,-0x22(%ebp)
c010221e:	c6 45 dd 03          	movb   $0x3,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102222:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0102226:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c010222a:	ee                   	out    %al,(%dx)
}
c010222b:	90                   	nop
c010222c:	66 c7 45 e2 a0 00    	movw   $0xa0,-0x1e(%ebp)
c0102232:	c6 45 e1 11          	movb   $0x11,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102236:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c010223a:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c010223e:	ee                   	out    %al,(%dx)
}
c010223f:	90                   	nop
c0102240:	66 c7 45 e6 a1 00    	movw   $0xa1,-0x1a(%ebp)
c0102246:	c6 45 e5 28          	movb   $0x28,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010224a:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c010224e:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0102252:	ee                   	out    %al,(%dx)
}
c0102253:	90                   	nop
c0102254:	66 c7 45 ea a1 00    	movw   $0xa1,-0x16(%ebp)
c010225a:	c6 45 e9 02          	movb   $0x2,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010225e:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0102262:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0102266:	ee                   	out    %al,(%dx)
}
c0102267:	90                   	nop
c0102268:	66 c7 45 ee a1 00    	movw   $0xa1,-0x12(%ebp)
c010226e:	c6 45 ed 03          	movb   $0x3,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102272:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0102276:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c010227a:	ee                   	out    %al,(%dx)
}
c010227b:	90                   	nop
c010227c:	66 c7 45 f2 20 00    	movw   $0x20,-0xe(%ebp)
c0102282:	c6 45 f1 68          	movb   $0x68,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102286:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c010228a:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010228e:	ee                   	out    %al,(%dx)
}
c010228f:	90                   	nop
c0102290:	66 c7 45 f6 20 00    	movw   $0x20,-0xa(%ebp)
c0102296:	c6 45 f5 0a          	movb   $0xa,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010229a:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c010229e:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01022a2:	ee                   	out    %al,(%dx)
}
c01022a3:	90                   	nop
c01022a4:	66 c7 45 fa a0 00    	movw   $0xa0,-0x6(%ebp)
c01022aa:	c6 45 f9 68          	movb   $0x68,-0x7(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01022ae:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c01022b2:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c01022b6:	ee                   	out    %al,(%dx)
}
c01022b7:	90                   	nop
c01022b8:	66 c7 45 fe a0 00    	movw   $0xa0,-0x2(%ebp)
c01022be:	c6 45 fd 0a          	movb   $0xa,-0x3(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01022c2:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c01022c6:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c01022ca:	ee                   	out    %al,(%dx)
}
c01022cb:	90                   	nop
    outb(IO_PIC1, 0x0a);    // read IRR by default

    outb(IO_PIC2, 0x68);    // OCW3
    outb(IO_PIC2, 0x0a);    // OCW3

    if (irq_mask != 0xFFFF) {
c01022cc:	0f b7 05 50 e5 12 c0 	movzwl 0xc012e550,%eax
c01022d3:	3d ff ff 00 00       	cmp    $0xffff,%eax
c01022d8:	74 0f                	je     c01022e9 <pic_init+0x149>
        pic_setmask(irq_mask);
c01022da:	0f b7 05 50 e5 12 c0 	movzwl 0xc012e550,%eax
c01022e1:	89 04 24             	mov    %eax,(%esp)
c01022e4:	e8 21 fe ff ff       	call   c010210a <pic_setmask>
    }
}
c01022e9:	90                   	nop
c01022ea:	c9                   	leave  
c01022eb:	c3                   	ret    

c01022ec <intr_enable>:
#include <x86.h>
#include <intr.h>

/* intr_enable - enable irq interrupt */
void
intr_enable(void) {
c01022ec:	f3 0f 1e fb          	endbr32 
c01022f0:	55                   	push   %ebp
c01022f1:	89 e5                	mov    %esp,%ebp
    asm volatile ("sti");
c01022f3:	fb                   	sti    
}
c01022f4:	90                   	nop
    sti();
}
c01022f5:	90                   	nop
c01022f6:	5d                   	pop    %ebp
c01022f7:	c3                   	ret    

c01022f8 <intr_disable>:

/* intr_disable - disable irq interrupt */
void
intr_disable(void) {
c01022f8:	f3 0f 1e fb          	endbr32 
c01022fc:	55                   	push   %ebp
c01022fd:	89 e5                	mov    %esp,%ebp
    asm volatile ("cli" ::: "memory");
c01022ff:	fa                   	cli    
}
c0102300:	90                   	nop
    cli();
}
c0102301:	90                   	nop
c0102302:	5d                   	pop    %ebp
c0102303:	c3                   	ret    

c0102304 <print_ticks>:
#include <sched.h>
#include <sync.h>

#define TICK_NUM 100

static void print_ticks() {
c0102304:	f3 0f 1e fb          	endbr32 
c0102308:	55                   	push   %ebp
c0102309:	89 e5                	mov    %esp,%ebp
c010230b:	83 ec 18             	sub    $0x18,%esp
    cprintf("%d ticks\n",TICK_NUM);
c010230e:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c0102315:	00 
c0102316:	c7 04 24 c0 c5 10 c0 	movl   $0xc010c5c0,(%esp)
c010231d:	e8 af df ff ff       	call   c01002d1 <cprintf>
#ifdef DEBUG_GRADE
    cprintf("End of Test.\n");
c0102322:	c7 04 24 ca c5 10 c0 	movl   $0xc010c5ca,(%esp)
c0102329:	e8 a3 df ff ff       	call   c01002d1 <cprintf>
    panic("EOT: kernel seems ok.");
c010232e:	c7 44 24 08 d8 c5 10 	movl   $0xc010c5d8,0x8(%esp)
c0102335:	c0 
c0102336:	c7 44 24 04 19 00 00 	movl   $0x19,0x4(%esp)
c010233d:	00 
c010233e:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c0102345:	e8 f3 e0 ff ff       	call   c010043d <__panic>

c010234a <idt_init>:
    sizeof(idt) - 1, (uintptr_t)idt
};

/* idt_init - initialize IDT to each of the entry points in kern/trap/vectors.S */
void
idt_init(void) {
c010234a:	f3 0f 1e fb          	endbr32 
c010234e:	55                   	push   %ebp
c010234f:	89 e5                	mov    %esp,%ebp
c0102351:	83 ec 10             	sub    $0x10,%esp
      *     You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
      *     Notice: the argument of lidt is idt_pd. try to find it!
      */
	extern uintptr_t __vectors[];
	int u;
	for(u=0;u<sizeof(idt)/sizeof(struct gatedesc);u++)
c0102354:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c010235b:	e9 c4 00 00 00       	jmp    c0102424 <idt_init+0xda>
		SETGATE(idt[u],0,GD_KTEXT,__vectors[u],DPL_KERNEL);
c0102360:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102363:	8b 04 85 e0 e5 12 c0 	mov    -0x3fed1a20(,%eax,4),%eax
c010236a:	0f b7 d0             	movzwl %ax,%edx
c010236d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102370:	66 89 14 c5 60 17 1b 	mov    %dx,-0x3fe4e8a0(,%eax,8)
c0102377:	c0 
c0102378:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010237b:	66 c7 04 c5 62 17 1b 	movw   $0x8,-0x3fe4e89e(,%eax,8)
c0102382:	c0 08 00 
c0102385:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102388:	0f b6 14 c5 64 17 1b 	movzbl -0x3fe4e89c(,%eax,8),%edx
c010238f:	c0 
c0102390:	80 e2 e0             	and    $0xe0,%dl
c0102393:	88 14 c5 64 17 1b c0 	mov    %dl,-0x3fe4e89c(,%eax,8)
c010239a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010239d:	0f b6 14 c5 64 17 1b 	movzbl -0x3fe4e89c(,%eax,8),%edx
c01023a4:	c0 
c01023a5:	80 e2 1f             	and    $0x1f,%dl
c01023a8:	88 14 c5 64 17 1b c0 	mov    %dl,-0x3fe4e89c(,%eax,8)
c01023af:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01023b2:	0f b6 14 c5 65 17 1b 	movzbl -0x3fe4e89b(,%eax,8),%edx
c01023b9:	c0 
c01023ba:	80 e2 f0             	and    $0xf0,%dl
c01023bd:	80 ca 0e             	or     $0xe,%dl
c01023c0:	88 14 c5 65 17 1b c0 	mov    %dl,-0x3fe4e89b(,%eax,8)
c01023c7:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01023ca:	0f b6 14 c5 65 17 1b 	movzbl -0x3fe4e89b(,%eax,8),%edx
c01023d1:	c0 
c01023d2:	80 e2 ef             	and    $0xef,%dl
c01023d5:	88 14 c5 65 17 1b c0 	mov    %dl,-0x3fe4e89b(,%eax,8)
c01023dc:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01023df:	0f b6 14 c5 65 17 1b 	movzbl -0x3fe4e89b(,%eax,8),%edx
c01023e6:	c0 
c01023e7:	80 e2 9f             	and    $0x9f,%dl
c01023ea:	88 14 c5 65 17 1b c0 	mov    %dl,-0x3fe4e89b(,%eax,8)
c01023f1:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01023f4:	0f b6 14 c5 65 17 1b 	movzbl -0x3fe4e89b(,%eax,8),%edx
c01023fb:	c0 
c01023fc:	80 ca 80             	or     $0x80,%dl
c01023ff:	88 14 c5 65 17 1b c0 	mov    %dl,-0x3fe4e89b(,%eax,8)
c0102406:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102409:	8b 04 85 e0 e5 12 c0 	mov    -0x3fed1a20(,%eax,4),%eax
c0102410:	c1 e8 10             	shr    $0x10,%eax
c0102413:	0f b7 d0             	movzwl %ax,%edx
c0102416:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102419:	66 89 14 c5 66 17 1b 	mov    %dx,-0x3fe4e89a(,%eax,8)
c0102420:	c0 
	for(u=0;u<sizeof(idt)/sizeof(struct gatedesc);u++)
c0102421:	ff 45 fc             	incl   -0x4(%ebp)
c0102424:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102427:	3d ff 00 00 00       	cmp    $0xff,%eax
c010242c:	0f 86 2e ff ff ff    	jbe    c0102360 <idt_init+0x16>
	SETGATE(idt[T_SYSCALL],1,GD_KTEXT,__vectors[T_SYSCALL],DPL_USER);
c0102432:	a1 e0 e7 12 c0       	mov    0xc012e7e0,%eax
c0102437:	0f b7 c0             	movzwl %ax,%eax
c010243a:	66 a3 60 1b 1b c0    	mov    %ax,0xc01b1b60
c0102440:	66 c7 05 62 1b 1b c0 	movw   $0x8,0xc01b1b62
c0102447:	08 00 
c0102449:	0f b6 05 64 1b 1b c0 	movzbl 0xc01b1b64,%eax
c0102450:	24 e0                	and    $0xe0,%al
c0102452:	a2 64 1b 1b c0       	mov    %al,0xc01b1b64
c0102457:	0f b6 05 64 1b 1b c0 	movzbl 0xc01b1b64,%eax
c010245e:	24 1f                	and    $0x1f,%al
c0102460:	a2 64 1b 1b c0       	mov    %al,0xc01b1b64
c0102465:	0f b6 05 65 1b 1b c0 	movzbl 0xc01b1b65,%eax
c010246c:	0c 0f                	or     $0xf,%al
c010246e:	a2 65 1b 1b c0       	mov    %al,0xc01b1b65
c0102473:	0f b6 05 65 1b 1b c0 	movzbl 0xc01b1b65,%eax
c010247a:	24 ef                	and    $0xef,%al
c010247c:	a2 65 1b 1b c0       	mov    %al,0xc01b1b65
c0102481:	0f b6 05 65 1b 1b c0 	movzbl 0xc01b1b65,%eax
c0102488:	0c 60                	or     $0x60,%al
c010248a:	a2 65 1b 1b c0       	mov    %al,0xc01b1b65
c010248f:	0f b6 05 65 1b 1b c0 	movzbl 0xc01b1b65,%eax
c0102496:	0c 80                	or     $0x80,%al
c0102498:	a2 65 1b 1b c0       	mov    %al,0xc01b1b65
c010249d:	a1 e0 e7 12 c0       	mov    0xc012e7e0,%eax
c01024a2:	c1 e8 10             	shr    $0x10,%eax
c01024a5:	0f b7 c0             	movzwl %ax,%eax
c01024a8:	66 a3 66 1b 1b c0    	mov    %ax,0xc01b1b66
c01024ae:	c7 45 f8 60 e5 12 c0 	movl   $0xc012e560,-0x8(%ebp)
    asm volatile ("lidt (%0)" :: "r" (pd) : "memory");
c01024b5:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01024b8:	0f 01 18             	lidtl  (%eax)
}
c01024bb:	90                   	nop
	lidt(&idt_pd);
	/* LAB5 YOUR CODE */ 
     //you should update your lab1 code (just add ONE or TWO lines of code), let user app to use syscall to get the service of ucore
     //so you should setup the syscall interrupt gate in here
}
c01024bc:	90                   	nop
c01024bd:	c9                   	leave  
c01024be:	c3                   	ret    

c01024bf <trapname>:

static const char *
trapname(int trapno) {
c01024bf:	f3 0f 1e fb          	endbr32 
c01024c3:	55                   	push   %ebp
c01024c4:	89 e5                	mov    %esp,%ebp
        "Alignment Check",
        "Machine-Check",
        "SIMD Floating-Point Exception"
    };

    if (trapno < sizeof(excnames)/sizeof(const char * const)) {
c01024c6:	8b 45 08             	mov    0x8(%ebp),%eax
c01024c9:	83 f8 13             	cmp    $0x13,%eax
c01024cc:	77 0c                	ja     c01024da <trapname+0x1b>
        return excnames[trapno];
c01024ce:	8b 45 08             	mov    0x8(%ebp),%eax
c01024d1:	8b 04 85 00 cb 10 c0 	mov    -0x3fef3500(,%eax,4),%eax
c01024d8:	eb 18                	jmp    c01024f2 <trapname+0x33>
    }
    if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16) {
c01024da:	83 7d 08 1f          	cmpl   $0x1f,0x8(%ebp)
c01024de:	7e 0d                	jle    c01024ed <trapname+0x2e>
c01024e0:	83 7d 08 2f          	cmpl   $0x2f,0x8(%ebp)
c01024e4:	7f 07                	jg     c01024ed <trapname+0x2e>
        return "Hardware Interrupt";
c01024e6:	b8 ff c5 10 c0       	mov    $0xc010c5ff,%eax
c01024eb:	eb 05                	jmp    c01024f2 <trapname+0x33>
    }
    return "(unknown trap)";
c01024ed:	b8 12 c6 10 c0       	mov    $0xc010c612,%eax
}
c01024f2:	5d                   	pop    %ebp
c01024f3:	c3                   	ret    

c01024f4 <trap_in_kernel>:

/* trap_in_kernel - test if trap happened in kernel */
bool
trap_in_kernel(struct trapframe *tf) {
c01024f4:	f3 0f 1e fb          	endbr32 
c01024f8:	55                   	push   %ebp
c01024f9:	89 e5                	mov    %esp,%ebp
    return (tf->tf_cs == (uint16_t)KERNEL_CS);
c01024fb:	8b 45 08             	mov    0x8(%ebp),%eax
c01024fe:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c0102502:	83 f8 08             	cmp    $0x8,%eax
c0102505:	0f 94 c0             	sete   %al
c0102508:	0f b6 c0             	movzbl %al,%eax
}
c010250b:	5d                   	pop    %ebp
c010250c:	c3                   	ret    

c010250d <print_trapframe>:
    "TF", "IF", "DF", "OF", NULL, NULL, "NT", NULL,
    "RF", "VM", "AC", "VIF", "VIP", "ID", NULL, NULL,
};

void
print_trapframe(struct trapframe *tf) {
c010250d:	f3 0f 1e fb          	endbr32 
c0102511:	55                   	push   %ebp
c0102512:	89 e5                	mov    %esp,%ebp
c0102514:	83 ec 28             	sub    $0x28,%esp
    cprintf("trapframe at %p\n", tf);
c0102517:	8b 45 08             	mov    0x8(%ebp),%eax
c010251a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010251e:	c7 04 24 53 c6 10 c0 	movl   $0xc010c653,(%esp)
c0102525:	e8 a7 dd ff ff       	call   c01002d1 <cprintf>
    print_regs(&tf->tf_regs);
c010252a:	8b 45 08             	mov    0x8(%ebp),%eax
c010252d:	89 04 24             	mov    %eax,(%esp)
c0102530:	e8 8d 01 00 00       	call   c01026c2 <print_regs>
    cprintf("  ds   0x----%04x\n", tf->tf_ds);
c0102535:	8b 45 08             	mov    0x8(%ebp),%eax
c0102538:	0f b7 40 2c          	movzwl 0x2c(%eax),%eax
c010253c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102540:	c7 04 24 64 c6 10 c0 	movl   $0xc010c664,(%esp)
c0102547:	e8 85 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  es   0x----%04x\n", tf->tf_es);
c010254c:	8b 45 08             	mov    0x8(%ebp),%eax
c010254f:	0f b7 40 28          	movzwl 0x28(%eax),%eax
c0102553:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102557:	c7 04 24 77 c6 10 c0 	movl   $0xc010c677,(%esp)
c010255e:	e8 6e dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  fs   0x----%04x\n", tf->tf_fs);
c0102563:	8b 45 08             	mov    0x8(%ebp),%eax
c0102566:	0f b7 40 24          	movzwl 0x24(%eax),%eax
c010256a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010256e:	c7 04 24 8a c6 10 c0 	movl   $0xc010c68a,(%esp)
c0102575:	e8 57 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  gs   0x----%04x\n", tf->tf_gs);
c010257a:	8b 45 08             	mov    0x8(%ebp),%eax
c010257d:	0f b7 40 20          	movzwl 0x20(%eax),%eax
c0102581:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102585:	c7 04 24 9d c6 10 c0 	movl   $0xc010c69d,(%esp)
c010258c:	e8 40 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
c0102591:	8b 45 08             	mov    0x8(%ebp),%eax
c0102594:	8b 40 30             	mov    0x30(%eax),%eax
c0102597:	89 04 24             	mov    %eax,(%esp)
c010259a:	e8 20 ff ff ff       	call   c01024bf <trapname>
c010259f:	8b 55 08             	mov    0x8(%ebp),%edx
c01025a2:	8b 52 30             	mov    0x30(%edx),%edx
c01025a5:	89 44 24 08          	mov    %eax,0x8(%esp)
c01025a9:	89 54 24 04          	mov    %edx,0x4(%esp)
c01025ad:	c7 04 24 b0 c6 10 c0 	movl   $0xc010c6b0,(%esp)
c01025b4:	e8 18 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  err  0x%08x\n", tf->tf_err);
c01025b9:	8b 45 08             	mov    0x8(%ebp),%eax
c01025bc:	8b 40 34             	mov    0x34(%eax),%eax
c01025bf:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025c3:	c7 04 24 c2 c6 10 c0 	movl   $0xc010c6c2,(%esp)
c01025ca:	e8 02 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
c01025cf:	8b 45 08             	mov    0x8(%ebp),%eax
c01025d2:	8b 40 38             	mov    0x38(%eax),%eax
c01025d5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025d9:	c7 04 24 d1 c6 10 c0 	movl   $0xc010c6d1,(%esp)
c01025e0:	e8 ec dc ff ff       	call   c01002d1 <cprintf>
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
c01025e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01025e8:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c01025ec:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025f0:	c7 04 24 e0 c6 10 c0 	movl   $0xc010c6e0,(%esp)
c01025f7:	e8 d5 dc ff ff       	call   c01002d1 <cprintf>
    cprintf("  flag 0x%08x ", tf->tf_eflags);
c01025fc:	8b 45 08             	mov    0x8(%ebp),%eax
c01025ff:	8b 40 40             	mov    0x40(%eax),%eax
c0102602:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102606:	c7 04 24 f3 c6 10 c0 	movl   $0xc010c6f3,(%esp)
c010260d:	e8 bf dc ff ff       	call   c01002d1 <cprintf>

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c0102612:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0102619:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
c0102620:	eb 3d                	jmp    c010265f <print_trapframe+0x152>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
c0102622:	8b 45 08             	mov    0x8(%ebp),%eax
c0102625:	8b 50 40             	mov    0x40(%eax),%edx
c0102628:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010262b:	21 d0                	and    %edx,%eax
c010262d:	85 c0                	test   %eax,%eax
c010262f:	74 28                	je     c0102659 <print_trapframe+0x14c>
c0102631:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102634:	8b 04 85 80 e5 12 c0 	mov    -0x3fed1a80(,%eax,4),%eax
c010263b:	85 c0                	test   %eax,%eax
c010263d:	74 1a                	je     c0102659 <print_trapframe+0x14c>
            cprintf("%s,", IA32flags[i]);
c010263f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102642:	8b 04 85 80 e5 12 c0 	mov    -0x3fed1a80(,%eax,4),%eax
c0102649:	89 44 24 04          	mov    %eax,0x4(%esp)
c010264d:	c7 04 24 02 c7 10 c0 	movl   $0xc010c702,(%esp)
c0102654:	e8 78 dc ff ff       	call   c01002d1 <cprintf>
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c0102659:	ff 45 f4             	incl   -0xc(%ebp)
c010265c:	d1 65 f0             	shll   -0x10(%ebp)
c010265f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102662:	83 f8 17             	cmp    $0x17,%eax
c0102665:	76 bb                	jbe    c0102622 <print_trapframe+0x115>
        }
    }
    cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);
c0102667:	8b 45 08             	mov    0x8(%ebp),%eax
c010266a:	8b 40 40             	mov    0x40(%eax),%eax
c010266d:	c1 e8 0c             	shr    $0xc,%eax
c0102670:	83 e0 03             	and    $0x3,%eax
c0102673:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102677:	c7 04 24 06 c7 10 c0 	movl   $0xc010c706,(%esp)
c010267e:	e8 4e dc ff ff       	call   c01002d1 <cprintf>

    if (!trap_in_kernel(tf)) {
c0102683:	8b 45 08             	mov    0x8(%ebp),%eax
c0102686:	89 04 24             	mov    %eax,(%esp)
c0102689:	e8 66 fe ff ff       	call   c01024f4 <trap_in_kernel>
c010268e:	85 c0                	test   %eax,%eax
c0102690:	75 2d                	jne    c01026bf <print_trapframe+0x1b2>
        cprintf("  esp  0x%08x\n", tf->tf_esp);
c0102692:	8b 45 08             	mov    0x8(%ebp),%eax
c0102695:	8b 40 44             	mov    0x44(%eax),%eax
c0102698:	89 44 24 04          	mov    %eax,0x4(%esp)
c010269c:	c7 04 24 0f c7 10 c0 	movl   $0xc010c70f,(%esp)
c01026a3:	e8 29 dc ff ff       	call   c01002d1 <cprintf>
        cprintf("  ss   0x----%04x\n", tf->tf_ss);
c01026a8:	8b 45 08             	mov    0x8(%ebp),%eax
c01026ab:	0f b7 40 48          	movzwl 0x48(%eax),%eax
c01026af:	89 44 24 04          	mov    %eax,0x4(%esp)
c01026b3:	c7 04 24 1e c7 10 c0 	movl   $0xc010c71e,(%esp)
c01026ba:	e8 12 dc ff ff       	call   c01002d1 <cprintf>
    }
}
c01026bf:	90                   	nop
c01026c0:	c9                   	leave  
c01026c1:	c3                   	ret    

c01026c2 <print_regs>:

void
print_regs(struct pushregs *regs) {
c01026c2:	f3 0f 1e fb          	endbr32 
c01026c6:	55                   	push   %ebp
c01026c7:	89 e5                	mov    %esp,%ebp
c01026c9:	83 ec 18             	sub    $0x18,%esp
    cprintf("  edi  0x%08x\n", regs->reg_edi);
c01026cc:	8b 45 08             	mov    0x8(%ebp),%eax
c01026cf:	8b 00                	mov    (%eax),%eax
c01026d1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01026d5:	c7 04 24 31 c7 10 c0 	movl   $0xc010c731,(%esp)
c01026dc:	e8 f0 db ff ff       	call   c01002d1 <cprintf>
    cprintf("  esi  0x%08x\n", regs->reg_esi);
c01026e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01026e4:	8b 40 04             	mov    0x4(%eax),%eax
c01026e7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01026eb:	c7 04 24 40 c7 10 c0 	movl   $0xc010c740,(%esp)
c01026f2:	e8 da db ff ff       	call   c01002d1 <cprintf>
    cprintf("  ebp  0x%08x\n", regs->reg_ebp);
c01026f7:	8b 45 08             	mov    0x8(%ebp),%eax
c01026fa:	8b 40 08             	mov    0x8(%eax),%eax
c01026fd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102701:	c7 04 24 4f c7 10 c0 	movl   $0xc010c74f,(%esp)
c0102708:	e8 c4 db ff ff       	call   c01002d1 <cprintf>
    cprintf("  oesp 0x%08x\n", regs->reg_oesp);
c010270d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102710:	8b 40 0c             	mov    0xc(%eax),%eax
c0102713:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102717:	c7 04 24 5e c7 10 c0 	movl   $0xc010c75e,(%esp)
c010271e:	e8 ae db ff ff       	call   c01002d1 <cprintf>
    cprintf("  ebx  0x%08x\n", regs->reg_ebx);
c0102723:	8b 45 08             	mov    0x8(%ebp),%eax
c0102726:	8b 40 10             	mov    0x10(%eax),%eax
c0102729:	89 44 24 04          	mov    %eax,0x4(%esp)
c010272d:	c7 04 24 6d c7 10 c0 	movl   $0xc010c76d,(%esp)
c0102734:	e8 98 db ff ff       	call   c01002d1 <cprintf>
    cprintf("  edx  0x%08x\n", regs->reg_edx);
c0102739:	8b 45 08             	mov    0x8(%ebp),%eax
c010273c:	8b 40 14             	mov    0x14(%eax),%eax
c010273f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102743:	c7 04 24 7c c7 10 c0 	movl   $0xc010c77c,(%esp)
c010274a:	e8 82 db ff ff       	call   c01002d1 <cprintf>
    cprintf("  ecx  0x%08x\n", regs->reg_ecx);
c010274f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102752:	8b 40 18             	mov    0x18(%eax),%eax
c0102755:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102759:	c7 04 24 8b c7 10 c0 	movl   $0xc010c78b,(%esp)
c0102760:	e8 6c db ff ff       	call   c01002d1 <cprintf>
    cprintf("  eax  0x%08x\n", regs->reg_eax);
c0102765:	8b 45 08             	mov    0x8(%ebp),%eax
c0102768:	8b 40 1c             	mov    0x1c(%eax),%eax
c010276b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010276f:	c7 04 24 9a c7 10 c0 	movl   $0xc010c79a,(%esp)
c0102776:	e8 56 db ff ff       	call   c01002d1 <cprintf>
}
c010277b:	90                   	nop
c010277c:	c9                   	leave  
c010277d:	c3                   	ret    

c010277e <print_pgfault>:

static inline void
print_pgfault(struct trapframe *tf) {
c010277e:	55                   	push   %ebp
c010277f:	89 e5                	mov    %esp,%ebp
c0102781:	53                   	push   %ebx
c0102782:	83 ec 34             	sub    $0x34,%esp
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
c0102785:	8b 45 08             	mov    0x8(%ebp),%eax
c0102788:	8b 40 34             	mov    0x34(%eax),%eax
c010278b:	83 e0 01             	and    $0x1,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c010278e:	85 c0                	test   %eax,%eax
c0102790:	74 07                	je     c0102799 <print_pgfault+0x1b>
c0102792:	bb a9 c7 10 c0       	mov    $0xc010c7a9,%ebx
c0102797:	eb 05                	jmp    c010279e <print_pgfault+0x20>
c0102799:	bb ba c7 10 c0       	mov    $0xc010c7ba,%ebx
            (tf->tf_err & 2) ? 'W' : 'R',
c010279e:	8b 45 08             	mov    0x8(%ebp),%eax
c01027a1:	8b 40 34             	mov    0x34(%eax),%eax
c01027a4:	83 e0 02             	and    $0x2,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c01027a7:	85 c0                	test   %eax,%eax
c01027a9:	74 07                	je     c01027b2 <print_pgfault+0x34>
c01027ab:	b9 57 00 00 00       	mov    $0x57,%ecx
c01027b0:	eb 05                	jmp    c01027b7 <print_pgfault+0x39>
c01027b2:	b9 52 00 00 00       	mov    $0x52,%ecx
            (tf->tf_err & 4) ? 'U' : 'K',
c01027b7:	8b 45 08             	mov    0x8(%ebp),%eax
c01027ba:	8b 40 34             	mov    0x34(%eax),%eax
c01027bd:	83 e0 04             	and    $0x4,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c01027c0:	85 c0                	test   %eax,%eax
c01027c2:	74 07                	je     c01027cb <print_pgfault+0x4d>
c01027c4:	ba 55 00 00 00       	mov    $0x55,%edx
c01027c9:	eb 05                	jmp    c01027d0 <print_pgfault+0x52>
c01027cb:	ba 4b 00 00 00       	mov    $0x4b,%edx
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c01027d0:	0f 20 d0             	mov    %cr2,%eax
c01027d3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c01027d6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01027d9:	89 5c 24 10          	mov    %ebx,0x10(%esp)
c01027dd:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c01027e1:	89 54 24 08          	mov    %edx,0x8(%esp)
c01027e5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01027e9:	c7 04 24 c8 c7 10 c0 	movl   $0xc010c7c8,(%esp)
c01027f0:	e8 dc da ff ff       	call   c01002d1 <cprintf>
}
c01027f5:	90                   	nop
c01027f6:	83 c4 34             	add    $0x34,%esp
c01027f9:	5b                   	pop    %ebx
c01027fa:	5d                   	pop    %ebp
c01027fb:	c3                   	ret    

c01027fc <pgfault_handler>:

static int
pgfault_handler(struct trapframe *tf) {
c01027fc:	f3 0f 1e fb          	endbr32 
c0102800:	55                   	push   %ebp
c0102801:	89 e5                	mov    %esp,%ebp
c0102803:	83 ec 28             	sub    $0x28,%esp
    extern struct mm_struct *check_mm_struct;
    if(check_mm_struct !=NULL) { //used for test check_swap
c0102806:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c010280b:	85 c0                	test   %eax,%eax
c010280d:	74 0b                	je     c010281a <pgfault_handler+0x1e>
            print_pgfault(tf);
c010280f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102812:	89 04 24             	mov    %eax,(%esp)
c0102815:	e8 64 ff ff ff       	call   c010277e <print_pgfault>
        }
    struct mm_struct *mm;
    if (check_mm_struct != NULL) {
c010281a:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c010281f:	85 c0                	test   %eax,%eax
c0102821:	74 3d                	je     c0102860 <pgfault_handler+0x64>
        assert(current == idleproc);
c0102823:	8b 15 28 20 1b c0    	mov    0xc01b2028,%edx
c0102829:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010282e:	39 c2                	cmp    %eax,%edx
c0102830:	74 24                	je     c0102856 <pgfault_handler+0x5a>
c0102832:	c7 44 24 0c eb c7 10 	movl   $0xc010c7eb,0xc(%esp)
c0102839:	c0 
c010283a:	c7 44 24 08 ff c7 10 	movl   $0xc010c7ff,0x8(%esp)
c0102841:	c0 
c0102842:	c7 44 24 04 ae 00 00 	movl   $0xae,0x4(%esp)
c0102849:	00 
c010284a:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c0102851:	e8 e7 db ff ff       	call   c010043d <__panic>
        mm = check_mm_struct;
c0102856:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c010285b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010285e:	eb 46                	jmp    c01028a6 <pgfault_handler+0xaa>
    }
    else {
        if (current == NULL) {
c0102860:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102865:	85 c0                	test   %eax,%eax
c0102867:	75 32                	jne    c010289b <pgfault_handler+0x9f>
            print_trapframe(tf);
c0102869:	8b 45 08             	mov    0x8(%ebp),%eax
c010286c:	89 04 24             	mov    %eax,(%esp)
c010286f:	e8 99 fc ff ff       	call   c010250d <print_trapframe>
            print_pgfault(tf);
c0102874:	8b 45 08             	mov    0x8(%ebp),%eax
c0102877:	89 04 24             	mov    %eax,(%esp)
c010287a:	e8 ff fe ff ff       	call   c010277e <print_pgfault>
            panic("unhandled page fault.\n");
c010287f:	c7 44 24 08 14 c8 10 	movl   $0xc010c814,0x8(%esp)
c0102886:	c0 
c0102887:	c7 44 24 04 b5 00 00 	movl   $0xb5,0x4(%esp)
c010288e:	00 
c010288f:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c0102896:	e8 a2 db ff ff       	call   c010043d <__panic>
        }
        mm = current->mm;
c010289b:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c01028a0:	8b 40 18             	mov    0x18(%eax),%eax
c01028a3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c01028a6:	0f 20 d0             	mov    %cr2,%eax
c01028a9:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return cr2;
c01028ac:	8b 55 f0             	mov    -0x10(%ebp),%edx
    }
    return do_pgfault(mm, tf->tf_err, rcr2());
c01028af:	8b 45 08             	mov    0x8(%ebp),%eax
c01028b2:	8b 40 34             	mov    0x34(%eax),%eax
c01028b5:	89 54 24 08          	mov    %edx,0x8(%esp)
c01028b9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01028bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01028c0:	89 04 24             	mov    %eax,(%esp)
c01028c3:	e8 06 41 00 00       	call   c01069ce <do_pgfault>
}
c01028c8:	c9                   	leave  
c01028c9:	c3                   	ret    

c01028ca <trap_dispatch>:

static volatile int in_swap_tick_event = 0;
extern struct mm_struct *check_mm_struct;

static void
trap_dispatch(struct trapframe *tf) {
c01028ca:	f3 0f 1e fb          	endbr32 
c01028ce:	55                   	push   %ebp
c01028cf:	89 e5                	mov    %esp,%ebp
c01028d1:	83 ec 28             	sub    $0x28,%esp
    char c;

    int ret=0;
c01028d4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

    switch (tf->tf_trapno) {
c01028db:	8b 45 08             	mov    0x8(%ebp),%eax
c01028de:	8b 40 30             	mov    0x30(%eax),%eax
c01028e1:	3d 80 00 00 00       	cmp    $0x80,%eax
c01028e6:	0f 84 f0 00 00 00    	je     c01029dc <trap_dispatch+0x112>
c01028ec:	3d 80 00 00 00       	cmp    $0x80,%eax
c01028f1:	0f 87 d4 01 00 00    	ja     c0102acb <trap_dispatch+0x201>
c01028f7:	83 f8 2f             	cmp    $0x2f,%eax
c01028fa:	77 1f                	ja     c010291b <trap_dispatch+0x51>
c01028fc:	83 f8 0e             	cmp    $0xe,%eax
c01028ff:	0f 82 c6 01 00 00    	jb     c0102acb <trap_dispatch+0x201>
c0102905:	83 e8 0e             	sub    $0xe,%eax
c0102908:	83 f8 21             	cmp    $0x21,%eax
c010290b:	0f 87 ba 01 00 00    	ja     c0102acb <trap_dispatch+0x201>
c0102911:	8b 04 85 20 c9 10 c0 	mov    -0x3fef36e0(,%eax,4),%eax
c0102918:	3e ff e0             	notrack jmp *%eax
c010291b:	83 e8 78             	sub    $0x78,%eax
c010291e:	83 f8 01             	cmp    $0x1,%eax
c0102921:	0f 87 a4 01 00 00    	ja     c0102acb <trap_dispatch+0x201>
c0102927:	e9 83 01 00 00       	jmp    c0102aaf <trap_dispatch+0x1e5>
    case T_PGFLT:  //page fault
        if ((ret = pgfault_handler(tf)) != 0) {
c010292c:	8b 45 08             	mov    0x8(%ebp),%eax
c010292f:	89 04 24             	mov    %eax,(%esp)
c0102932:	e8 c5 fe ff ff       	call   c01027fc <pgfault_handler>
c0102937:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010293a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010293e:	0f 84 d2 01 00 00    	je     c0102b16 <trap_dispatch+0x24c>
            print_trapframe(tf);
c0102944:	8b 45 08             	mov    0x8(%ebp),%eax
c0102947:	89 04 24             	mov    %eax,(%esp)
c010294a:	e8 be fb ff ff       	call   c010250d <print_trapframe>
            if (current == NULL) {
c010294f:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102954:	85 c0                	test   %eax,%eax
c0102956:	75 23                	jne    c010297b <trap_dispatch+0xb1>
                panic("handle pgfault failed. ret=%d\n", ret);
c0102958:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010295b:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010295f:	c7 44 24 08 2c c8 10 	movl   $0xc010c82c,0x8(%esp)
c0102966:	c0 
c0102967:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c010296e:	00 
c010296f:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c0102976:	e8 c2 da ff ff       	call   c010043d <__panic>
            }
            else {
                if (trap_in_kernel(tf)) {
c010297b:	8b 45 08             	mov    0x8(%ebp),%eax
c010297e:	89 04 24             	mov    %eax,(%esp)
c0102981:	e8 6e fb ff ff       	call   c01024f4 <trap_in_kernel>
c0102986:	85 c0                	test   %eax,%eax
c0102988:	74 23                	je     c01029ad <trap_dispatch+0xe3>
                    panic("handle pgfault failed in kernel mode. ret=%d\n", ret);
c010298a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010298d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0102991:	c7 44 24 08 4c c8 10 	movl   $0xc010c84c,0x8(%esp)
c0102998:	c0 
c0102999:	c7 44 24 04 ce 00 00 	movl   $0xce,0x4(%esp)
c01029a0:	00 
c01029a1:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c01029a8:	e8 90 da ff ff       	call   c010043d <__panic>
                }
                cprintf("killed by kernel.\n");
c01029ad:	c7 04 24 7a c8 10 c0 	movl   $0xc010c87a,(%esp)
c01029b4:	e8 18 d9 ff ff       	call   c01002d1 <cprintf>
                panic("handle user mode pgfault failed. ret=%d\n", ret); 
c01029b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01029bc:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01029c0:	c7 44 24 08 90 c8 10 	movl   $0xc010c890,0x8(%esp)
c01029c7:	c0 
c01029c8:	c7 44 24 04 d1 00 00 	movl   $0xd1,0x4(%esp)
c01029cf:	00 
c01029d0:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c01029d7:	e8 61 da ff ff       	call   c010043d <__panic>
                do_exit(-E_KILLED);
            }
        }
        break;
    case T_SYSCALL:
        syscall();
c01029dc:	e8 40 8a 00 00       	call   c010b421 <syscall>
        break;
c01029e1:	e9 34 01 00 00       	jmp    c0102b1a <trap_dispatch+0x250>
         * (3) Too Simple? Yes, I think so!
         */
        /* LAB5 YOUR CODE */
        /* you should upate you lab1 code (just add ONE or TWO lines of code):
         *    Every TICK_NUM cycle, you should set current process's current->need_resched = 1
         */ticks++;
c01029e6:	a1 54 40 1b c0       	mov    0xc01b4054,%eax
c01029eb:	40                   	inc    %eax
c01029ec:	a3 54 40 1b c0       	mov    %eax,0xc01b4054
	if(!(ticks%TICK_NUM)) 
c01029f1:	8b 0d 54 40 1b c0    	mov    0xc01b4054,%ecx
c01029f7:	ba 1f 85 eb 51       	mov    $0x51eb851f,%edx
c01029fc:	89 c8                	mov    %ecx,%eax
c01029fe:	f7 e2                	mul    %edx
c0102a00:	c1 ea 05             	shr    $0x5,%edx
c0102a03:	89 d0                	mov    %edx,%eax
c0102a05:	c1 e0 02             	shl    $0x2,%eax
c0102a08:	01 d0                	add    %edx,%eax
c0102a0a:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0102a11:	01 d0                	add    %edx,%eax
c0102a13:	c1 e0 02             	shl    $0x2,%eax
c0102a16:	29 c1                	sub    %eax,%ecx
c0102a18:	89 ca                	mov    %ecx,%edx
c0102a1a:	85 d2                	test   %edx,%edx
c0102a1c:	0f 85 f7 00 00 00    	jne    c0102b19 <trap_dispatch+0x24f>
	{assert(current);
c0102a22:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102a27:	85 c0                	test   %eax,%eax
c0102a29:	75 24                	jne    c0102a4f <trap_dispatch+0x185>
c0102a2b:	c7 44 24 0c b9 c8 10 	movl   $0xc010c8b9,0xc(%esp)
c0102a32:	c0 
c0102a33:	c7 44 24 08 ff c7 10 	movl   $0xc010c7ff,0x8(%esp)
c0102a3a:	c0 
c0102a3b:	c7 44 24 04 e9 00 00 	movl   $0xe9,0x4(%esp)
c0102a42:	00 
c0102a43:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c0102a4a:	e8 ee d9 ff ff       	call   c010043d <__panic>
	 current->need_resched=1;}
c0102a4f:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102a54:	c7 40 10 01 00 00 00 	movl   $0x1,0x10(%eax)
        break;
c0102a5b:	e9 b9 00 00 00       	jmp    c0102b19 <trap_dispatch+0x24f>
    case IRQ_OFFSET + IRQ_COM1:
        c = cons_getc();
c0102a60:	e8 32 f6 ff ff       	call   c0102097 <cons_getc>
c0102a65:	88 45 f3             	mov    %al,-0xd(%ebp)
        cprintf("serial [%03d] %c\n", c, c);
c0102a68:	0f be 55 f3          	movsbl -0xd(%ebp),%edx
c0102a6c:	0f be 45 f3          	movsbl -0xd(%ebp),%eax
c0102a70:	89 54 24 08          	mov    %edx,0x8(%esp)
c0102a74:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102a78:	c7 04 24 c1 c8 10 c0 	movl   $0xc010c8c1,(%esp)
c0102a7f:	e8 4d d8 ff ff       	call   c01002d1 <cprintf>
        break;
c0102a84:	e9 91 00 00 00       	jmp    c0102b1a <trap_dispatch+0x250>
    case IRQ_OFFSET + IRQ_KBD:
        c = cons_getc();
c0102a89:	e8 09 f6 ff ff       	call   c0102097 <cons_getc>
c0102a8e:	88 45 f3             	mov    %al,-0xd(%ebp)
        cprintf("kbd [%03d] %c\n", c, c);
c0102a91:	0f be 55 f3          	movsbl -0xd(%ebp),%edx
c0102a95:	0f be 45 f3          	movsbl -0xd(%ebp),%eax
c0102a99:	89 54 24 08          	mov    %edx,0x8(%esp)
c0102a9d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102aa1:	c7 04 24 d3 c8 10 c0 	movl   $0xc010c8d3,(%esp)
c0102aa8:	e8 24 d8 ff ff       	call   c01002d1 <cprintf>
        break;
c0102aad:	eb 6b                	jmp    c0102b1a <trap_dispatch+0x250>
    //LAB1 CHALLENGE 1 : YOUR CODE you should modify below codes.
    case T_SWITCH_TOU:
    case T_SWITCH_TOK:
        panic("T_SWITCH_** ??\n");
c0102aaf:	c7 44 24 08 e2 c8 10 	movl   $0xc010c8e2,0x8(%esp)
c0102ab6:	c0 
c0102ab7:	c7 44 24 04 f7 00 00 	movl   $0xf7,0x4(%esp)
c0102abe:	00 
c0102abf:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c0102ac6:	e8 72 d9 ff ff       	call   c010043d <__panic>
    case IRQ_OFFSET + IRQ_IDE1:
    case IRQ_OFFSET + IRQ_IDE2:
        /* do nothing */
        break;
    default:
        print_trapframe(tf);
c0102acb:	8b 45 08             	mov    0x8(%ebp),%eax
c0102ace:	89 04 24             	mov    %eax,(%esp)
c0102ad1:	e8 37 fa ff ff       	call   c010250d <print_trapframe>
        if (current != NULL) {
c0102ad6:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102adb:	85 c0                	test   %eax,%eax
c0102add:	74 18                	je     c0102af7 <trap_dispatch+0x22d>
            cprintf("unhandled trap.\n");
c0102adf:	c7 04 24 f2 c8 10 c0 	movl   $0xc010c8f2,(%esp)
c0102ae6:	e8 e6 d7 ff ff       	call   c01002d1 <cprintf>
            do_exit(-E_KILLED);
c0102aeb:	c7 04 24 f7 ff ff ff 	movl   $0xfffffff7,(%esp)
c0102af2:	e8 a9 76 00 00       	call   c010a1a0 <do_exit>
        }
        // in kernel, it must be a mistake
        panic("unexpected trap in kernel.\n");
c0102af7:	c7 44 24 08 03 c9 10 	movl   $0xc010c903,0x8(%esp)
c0102afe:	c0 
c0102aff:	c7 44 24 04 04 01 00 	movl   $0x104,0x4(%esp)
c0102b06:	00 
c0102b07:	c7 04 24 ee c5 10 c0 	movl   $0xc010c5ee,(%esp)
c0102b0e:	e8 2a d9 ff ff       	call   c010043d <__panic>
        break;
c0102b13:	90                   	nop
c0102b14:	eb 04                	jmp    c0102b1a <trap_dispatch+0x250>
        break;
c0102b16:	90                   	nop
c0102b17:	eb 01                	jmp    c0102b1a <trap_dispatch+0x250>
        break;
c0102b19:	90                   	nop

    }
}
c0102b1a:	90                   	nop
c0102b1b:	c9                   	leave  
c0102b1c:	c3                   	ret    

c0102b1d <trap>:
 * trap - handles or dispatches an exception/interrupt. if and when trap() returns,
 * the code in kern/trap/trapentry.S restores the old CPU state saved in the
 * trapframe and then uses the iret instruction to return from the exception.
 * */
void
trap(struct trapframe *tf) {
c0102b1d:	f3 0f 1e fb          	endbr32 
c0102b21:	55                   	push   %ebp
c0102b22:	89 e5                	mov    %esp,%ebp
c0102b24:	83 ec 28             	sub    $0x28,%esp
    // dispatch based on what type of trap occurred
    // used for previous projects
    if (current == NULL) {
c0102b27:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102b2c:	85 c0                	test   %eax,%eax
c0102b2e:	75 0d                	jne    c0102b3d <trap+0x20>
        trap_dispatch(tf);
c0102b30:	8b 45 08             	mov    0x8(%ebp),%eax
c0102b33:	89 04 24             	mov    %eax,(%esp)
c0102b36:	e8 8f fd ff ff       	call   c01028ca <trap_dispatch>
            if (current->need_resched) {
                schedule();
            }
        }
    }
}
c0102b3b:	eb 6c                	jmp    c0102ba9 <trap+0x8c>
        struct trapframe *otf = current->tf;
c0102b3d:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102b42:	8b 40 3c             	mov    0x3c(%eax),%eax
c0102b45:	89 45 f4             	mov    %eax,-0xc(%ebp)
        current->tf = tf;
c0102b48:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102b4d:	8b 55 08             	mov    0x8(%ebp),%edx
c0102b50:	89 50 3c             	mov    %edx,0x3c(%eax)
        bool in_kernel = trap_in_kernel(tf);
c0102b53:	8b 45 08             	mov    0x8(%ebp),%eax
c0102b56:	89 04 24             	mov    %eax,(%esp)
c0102b59:	e8 96 f9 ff ff       	call   c01024f4 <trap_in_kernel>
c0102b5e:	89 45 f0             	mov    %eax,-0x10(%ebp)
        trap_dispatch(tf);
c0102b61:	8b 45 08             	mov    0x8(%ebp),%eax
c0102b64:	89 04 24             	mov    %eax,(%esp)
c0102b67:	e8 5e fd ff ff       	call   c01028ca <trap_dispatch>
        current->tf = otf;
c0102b6c:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102b71:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0102b74:	89 50 3c             	mov    %edx,0x3c(%eax)
        if (!in_kernel) {
c0102b77:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0102b7b:	75 2c                	jne    c0102ba9 <trap+0x8c>
            if (current->flags & PF_EXITING) {
c0102b7d:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102b82:	8b 40 44             	mov    0x44(%eax),%eax
c0102b85:	83 e0 01             	and    $0x1,%eax
c0102b88:	85 c0                	test   %eax,%eax
c0102b8a:	74 0c                	je     c0102b98 <trap+0x7b>
                do_exit(-E_KILLED);
c0102b8c:	c7 04 24 f7 ff ff ff 	movl   $0xfffffff7,(%esp)
c0102b93:	e8 08 76 00 00       	call   c010a1a0 <do_exit>
            if (current->need_resched) {
c0102b98:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0102b9d:	8b 40 10             	mov    0x10(%eax),%eax
c0102ba0:	85 c0                	test   %eax,%eax
c0102ba2:	74 05                	je     c0102ba9 <trap+0x8c>
                schedule();
c0102ba4:	e8 52 86 00 00       	call   c010b1fb <schedule>
}
c0102ba9:	90                   	nop
c0102baa:	c9                   	leave  
c0102bab:	c3                   	ret    

c0102bac <vector0>:
# handler
.text
.globl __alltraps
.globl vector0
vector0:
  pushl $0
c0102bac:	6a 00                	push   $0x0
  pushl $0
c0102bae:	6a 00                	push   $0x0
  jmp __alltraps
c0102bb0:	e9 69 0a 00 00       	jmp    c010361e <__alltraps>

c0102bb5 <vector1>:
.globl vector1
vector1:
  pushl $0
c0102bb5:	6a 00                	push   $0x0
  pushl $1
c0102bb7:	6a 01                	push   $0x1
  jmp __alltraps
c0102bb9:	e9 60 0a 00 00       	jmp    c010361e <__alltraps>

c0102bbe <vector2>:
.globl vector2
vector2:
  pushl $0
c0102bbe:	6a 00                	push   $0x0
  pushl $2
c0102bc0:	6a 02                	push   $0x2
  jmp __alltraps
c0102bc2:	e9 57 0a 00 00       	jmp    c010361e <__alltraps>

c0102bc7 <vector3>:
.globl vector3
vector3:
  pushl $0
c0102bc7:	6a 00                	push   $0x0
  pushl $3
c0102bc9:	6a 03                	push   $0x3
  jmp __alltraps
c0102bcb:	e9 4e 0a 00 00       	jmp    c010361e <__alltraps>

c0102bd0 <vector4>:
.globl vector4
vector4:
  pushl $0
c0102bd0:	6a 00                	push   $0x0
  pushl $4
c0102bd2:	6a 04                	push   $0x4
  jmp __alltraps
c0102bd4:	e9 45 0a 00 00       	jmp    c010361e <__alltraps>

c0102bd9 <vector5>:
.globl vector5
vector5:
  pushl $0
c0102bd9:	6a 00                	push   $0x0
  pushl $5
c0102bdb:	6a 05                	push   $0x5
  jmp __alltraps
c0102bdd:	e9 3c 0a 00 00       	jmp    c010361e <__alltraps>

c0102be2 <vector6>:
.globl vector6
vector6:
  pushl $0
c0102be2:	6a 00                	push   $0x0
  pushl $6
c0102be4:	6a 06                	push   $0x6
  jmp __alltraps
c0102be6:	e9 33 0a 00 00       	jmp    c010361e <__alltraps>

c0102beb <vector7>:
.globl vector7
vector7:
  pushl $0
c0102beb:	6a 00                	push   $0x0
  pushl $7
c0102bed:	6a 07                	push   $0x7
  jmp __alltraps
c0102bef:	e9 2a 0a 00 00       	jmp    c010361e <__alltraps>

c0102bf4 <vector8>:
.globl vector8
vector8:
  pushl $8
c0102bf4:	6a 08                	push   $0x8
  jmp __alltraps
c0102bf6:	e9 23 0a 00 00       	jmp    c010361e <__alltraps>

c0102bfb <vector9>:
.globl vector9
vector9:
  pushl $0
c0102bfb:	6a 00                	push   $0x0
  pushl $9
c0102bfd:	6a 09                	push   $0x9
  jmp __alltraps
c0102bff:	e9 1a 0a 00 00       	jmp    c010361e <__alltraps>

c0102c04 <vector10>:
.globl vector10
vector10:
  pushl $10
c0102c04:	6a 0a                	push   $0xa
  jmp __alltraps
c0102c06:	e9 13 0a 00 00       	jmp    c010361e <__alltraps>

c0102c0b <vector11>:
.globl vector11
vector11:
  pushl $11
c0102c0b:	6a 0b                	push   $0xb
  jmp __alltraps
c0102c0d:	e9 0c 0a 00 00       	jmp    c010361e <__alltraps>

c0102c12 <vector12>:
.globl vector12
vector12:
  pushl $12
c0102c12:	6a 0c                	push   $0xc
  jmp __alltraps
c0102c14:	e9 05 0a 00 00       	jmp    c010361e <__alltraps>

c0102c19 <vector13>:
.globl vector13
vector13:
  pushl $13
c0102c19:	6a 0d                	push   $0xd
  jmp __alltraps
c0102c1b:	e9 fe 09 00 00       	jmp    c010361e <__alltraps>

c0102c20 <vector14>:
.globl vector14
vector14:
  pushl $14
c0102c20:	6a 0e                	push   $0xe
  jmp __alltraps
c0102c22:	e9 f7 09 00 00       	jmp    c010361e <__alltraps>

c0102c27 <vector15>:
.globl vector15
vector15:
  pushl $0
c0102c27:	6a 00                	push   $0x0
  pushl $15
c0102c29:	6a 0f                	push   $0xf
  jmp __alltraps
c0102c2b:	e9 ee 09 00 00       	jmp    c010361e <__alltraps>

c0102c30 <vector16>:
.globl vector16
vector16:
  pushl $0
c0102c30:	6a 00                	push   $0x0
  pushl $16
c0102c32:	6a 10                	push   $0x10
  jmp __alltraps
c0102c34:	e9 e5 09 00 00       	jmp    c010361e <__alltraps>

c0102c39 <vector17>:
.globl vector17
vector17:
  pushl $17
c0102c39:	6a 11                	push   $0x11
  jmp __alltraps
c0102c3b:	e9 de 09 00 00       	jmp    c010361e <__alltraps>

c0102c40 <vector18>:
.globl vector18
vector18:
  pushl $0
c0102c40:	6a 00                	push   $0x0
  pushl $18
c0102c42:	6a 12                	push   $0x12
  jmp __alltraps
c0102c44:	e9 d5 09 00 00       	jmp    c010361e <__alltraps>

c0102c49 <vector19>:
.globl vector19
vector19:
  pushl $0
c0102c49:	6a 00                	push   $0x0
  pushl $19
c0102c4b:	6a 13                	push   $0x13
  jmp __alltraps
c0102c4d:	e9 cc 09 00 00       	jmp    c010361e <__alltraps>

c0102c52 <vector20>:
.globl vector20
vector20:
  pushl $0
c0102c52:	6a 00                	push   $0x0
  pushl $20
c0102c54:	6a 14                	push   $0x14
  jmp __alltraps
c0102c56:	e9 c3 09 00 00       	jmp    c010361e <__alltraps>

c0102c5b <vector21>:
.globl vector21
vector21:
  pushl $0
c0102c5b:	6a 00                	push   $0x0
  pushl $21
c0102c5d:	6a 15                	push   $0x15
  jmp __alltraps
c0102c5f:	e9 ba 09 00 00       	jmp    c010361e <__alltraps>

c0102c64 <vector22>:
.globl vector22
vector22:
  pushl $0
c0102c64:	6a 00                	push   $0x0
  pushl $22
c0102c66:	6a 16                	push   $0x16
  jmp __alltraps
c0102c68:	e9 b1 09 00 00       	jmp    c010361e <__alltraps>

c0102c6d <vector23>:
.globl vector23
vector23:
  pushl $0
c0102c6d:	6a 00                	push   $0x0
  pushl $23
c0102c6f:	6a 17                	push   $0x17
  jmp __alltraps
c0102c71:	e9 a8 09 00 00       	jmp    c010361e <__alltraps>

c0102c76 <vector24>:
.globl vector24
vector24:
  pushl $0
c0102c76:	6a 00                	push   $0x0
  pushl $24
c0102c78:	6a 18                	push   $0x18
  jmp __alltraps
c0102c7a:	e9 9f 09 00 00       	jmp    c010361e <__alltraps>

c0102c7f <vector25>:
.globl vector25
vector25:
  pushl $0
c0102c7f:	6a 00                	push   $0x0
  pushl $25
c0102c81:	6a 19                	push   $0x19
  jmp __alltraps
c0102c83:	e9 96 09 00 00       	jmp    c010361e <__alltraps>

c0102c88 <vector26>:
.globl vector26
vector26:
  pushl $0
c0102c88:	6a 00                	push   $0x0
  pushl $26
c0102c8a:	6a 1a                	push   $0x1a
  jmp __alltraps
c0102c8c:	e9 8d 09 00 00       	jmp    c010361e <__alltraps>

c0102c91 <vector27>:
.globl vector27
vector27:
  pushl $0
c0102c91:	6a 00                	push   $0x0
  pushl $27
c0102c93:	6a 1b                	push   $0x1b
  jmp __alltraps
c0102c95:	e9 84 09 00 00       	jmp    c010361e <__alltraps>

c0102c9a <vector28>:
.globl vector28
vector28:
  pushl $0
c0102c9a:	6a 00                	push   $0x0
  pushl $28
c0102c9c:	6a 1c                	push   $0x1c
  jmp __alltraps
c0102c9e:	e9 7b 09 00 00       	jmp    c010361e <__alltraps>

c0102ca3 <vector29>:
.globl vector29
vector29:
  pushl $0
c0102ca3:	6a 00                	push   $0x0
  pushl $29
c0102ca5:	6a 1d                	push   $0x1d
  jmp __alltraps
c0102ca7:	e9 72 09 00 00       	jmp    c010361e <__alltraps>

c0102cac <vector30>:
.globl vector30
vector30:
  pushl $0
c0102cac:	6a 00                	push   $0x0
  pushl $30
c0102cae:	6a 1e                	push   $0x1e
  jmp __alltraps
c0102cb0:	e9 69 09 00 00       	jmp    c010361e <__alltraps>

c0102cb5 <vector31>:
.globl vector31
vector31:
  pushl $0
c0102cb5:	6a 00                	push   $0x0
  pushl $31
c0102cb7:	6a 1f                	push   $0x1f
  jmp __alltraps
c0102cb9:	e9 60 09 00 00       	jmp    c010361e <__alltraps>

c0102cbe <vector32>:
.globl vector32
vector32:
  pushl $0
c0102cbe:	6a 00                	push   $0x0
  pushl $32
c0102cc0:	6a 20                	push   $0x20
  jmp __alltraps
c0102cc2:	e9 57 09 00 00       	jmp    c010361e <__alltraps>

c0102cc7 <vector33>:
.globl vector33
vector33:
  pushl $0
c0102cc7:	6a 00                	push   $0x0
  pushl $33
c0102cc9:	6a 21                	push   $0x21
  jmp __alltraps
c0102ccb:	e9 4e 09 00 00       	jmp    c010361e <__alltraps>

c0102cd0 <vector34>:
.globl vector34
vector34:
  pushl $0
c0102cd0:	6a 00                	push   $0x0
  pushl $34
c0102cd2:	6a 22                	push   $0x22
  jmp __alltraps
c0102cd4:	e9 45 09 00 00       	jmp    c010361e <__alltraps>

c0102cd9 <vector35>:
.globl vector35
vector35:
  pushl $0
c0102cd9:	6a 00                	push   $0x0
  pushl $35
c0102cdb:	6a 23                	push   $0x23
  jmp __alltraps
c0102cdd:	e9 3c 09 00 00       	jmp    c010361e <__alltraps>

c0102ce2 <vector36>:
.globl vector36
vector36:
  pushl $0
c0102ce2:	6a 00                	push   $0x0
  pushl $36
c0102ce4:	6a 24                	push   $0x24
  jmp __alltraps
c0102ce6:	e9 33 09 00 00       	jmp    c010361e <__alltraps>

c0102ceb <vector37>:
.globl vector37
vector37:
  pushl $0
c0102ceb:	6a 00                	push   $0x0
  pushl $37
c0102ced:	6a 25                	push   $0x25
  jmp __alltraps
c0102cef:	e9 2a 09 00 00       	jmp    c010361e <__alltraps>

c0102cf4 <vector38>:
.globl vector38
vector38:
  pushl $0
c0102cf4:	6a 00                	push   $0x0
  pushl $38
c0102cf6:	6a 26                	push   $0x26
  jmp __alltraps
c0102cf8:	e9 21 09 00 00       	jmp    c010361e <__alltraps>

c0102cfd <vector39>:
.globl vector39
vector39:
  pushl $0
c0102cfd:	6a 00                	push   $0x0
  pushl $39
c0102cff:	6a 27                	push   $0x27
  jmp __alltraps
c0102d01:	e9 18 09 00 00       	jmp    c010361e <__alltraps>

c0102d06 <vector40>:
.globl vector40
vector40:
  pushl $0
c0102d06:	6a 00                	push   $0x0
  pushl $40
c0102d08:	6a 28                	push   $0x28
  jmp __alltraps
c0102d0a:	e9 0f 09 00 00       	jmp    c010361e <__alltraps>

c0102d0f <vector41>:
.globl vector41
vector41:
  pushl $0
c0102d0f:	6a 00                	push   $0x0
  pushl $41
c0102d11:	6a 29                	push   $0x29
  jmp __alltraps
c0102d13:	e9 06 09 00 00       	jmp    c010361e <__alltraps>

c0102d18 <vector42>:
.globl vector42
vector42:
  pushl $0
c0102d18:	6a 00                	push   $0x0
  pushl $42
c0102d1a:	6a 2a                	push   $0x2a
  jmp __alltraps
c0102d1c:	e9 fd 08 00 00       	jmp    c010361e <__alltraps>

c0102d21 <vector43>:
.globl vector43
vector43:
  pushl $0
c0102d21:	6a 00                	push   $0x0
  pushl $43
c0102d23:	6a 2b                	push   $0x2b
  jmp __alltraps
c0102d25:	e9 f4 08 00 00       	jmp    c010361e <__alltraps>

c0102d2a <vector44>:
.globl vector44
vector44:
  pushl $0
c0102d2a:	6a 00                	push   $0x0
  pushl $44
c0102d2c:	6a 2c                	push   $0x2c
  jmp __alltraps
c0102d2e:	e9 eb 08 00 00       	jmp    c010361e <__alltraps>

c0102d33 <vector45>:
.globl vector45
vector45:
  pushl $0
c0102d33:	6a 00                	push   $0x0
  pushl $45
c0102d35:	6a 2d                	push   $0x2d
  jmp __alltraps
c0102d37:	e9 e2 08 00 00       	jmp    c010361e <__alltraps>

c0102d3c <vector46>:
.globl vector46
vector46:
  pushl $0
c0102d3c:	6a 00                	push   $0x0
  pushl $46
c0102d3e:	6a 2e                	push   $0x2e
  jmp __alltraps
c0102d40:	e9 d9 08 00 00       	jmp    c010361e <__alltraps>

c0102d45 <vector47>:
.globl vector47
vector47:
  pushl $0
c0102d45:	6a 00                	push   $0x0
  pushl $47
c0102d47:	6a 2f                	push   $0x2f
  jmp __alltraps
c0102d49:	e9 d0 08 00 00       	jmp    c010361e <__alltraps>

c0102d4e <vector48>:
.globl vector48
vector48:
  pushl $0
c0102d4e:	6a 00                	push   $0x0
  pushl $48
c0102d50:	6a 30                	push   $0x30
  jmp __alltraps
c0102d52:	e9 c7 08 00 00       	jmp    c010361e <__alltraps>

c0102d57 <vector49>:
.globl vector49
vector49:
  pushl $0
c0102d57:	6a 00                	push   $0x0
  pushl $49
c0102d59:	6a 31                	push   $0x31
  jmp __alltraps
c0102d5b:	e9 be 08 00 00       	jmp    c010361e <__alltraps>

c0102d60 <vector50>:
.globl vector50
vector50:
  pushl $0
c0102d60:	6a 00                	push   $0x0
  pushl $50
c0102d62:	6a 32                	push   $0x32
  jmp __alltraps
c0102d64:	e9 b5 08 00 00       	jmp    c010361e <__alltraps>

c0102d69 <vector51>:
.globl vector51
vector51:
  pushl $0
c0102d69:	6a 00                	push   $0x0
  pushl $51
c0102d6b:	6a 33                	push   $0x33
  jmp __alltraps
c0102d6d:	e9 ac 08 00 00       	jmp    c010361e <__alltraps>

c0102d72 <vector52>:
.globl vector52
vector52:
  pushl $0
c0102d72:	6a 00                	push   $0x0
  pushl $52
c0102d74:	6a 34                	push   $0x34
  jmp __alltraps
c0102d76:	e9 a3 08 00 00       	jmp    c010361e <__alltraps>

c0102d7b <vector53>:
.globl vector53
vector53:
  pushl $0
c0102d7b:	6a 00                	push   $0x0
  pushl $53
c0102d7d:	6a 35                	push   $0x35
  jmp __alltraps
c0102d7f:	e9 9a 08 00 00       	jmp    c010361e <__alltraps>

c0102d84 <vector54>:
.globl vector54
vector54:
  pushl $0
c0102d84:	6a 00                	push   $0x0
  pushl $54
c0102d86:	6a 36                	push   $0x36
  jmp __alltraps
c0102d88:	e9 91 08 00 00       	jmp    c010361e <__alltraps>

c0102d8d <vector55>:
.globl vector55
vector55:
  pushl $0
c0102d8d:	6a 00                	push   $0x0
  pushl $55
c0102d8f:	6a 37                	push   $0x37
  jmp __alltraps
c0102d91:	e9 88 08 00 00       	jmp    c010361e <__alltraps>

c0102d96 <vector56>:
.globl vector56
vector56:
  pushl $0
c0102d96:	6a 00                	push   $0x0
  pushl $56
c0102d98:	6a 38                	push   $0x38
  jmp __alltraps
c0102d9a:	e9 7f 08 00 00       	jmp    c010361e <__alltraps>

c0102d9f <vector57>:
.globl vector57
vector57:
  pushl $0
c0102d9f:	6a 00                	push   $0x0
  pushl $57
c0102da1:	6a 39                	push   $0x39
  jmp __alltraps
c0102da3:	e9 76 08 00 00       	jmp    c010361e <__alltraps>

c0102da8 <vector58>:
.globl vector58
vector58:
  pushl $0
c0102da8:	6a 00                	push   $0x0
  pushl $58
c0102daa:	6a 3a                	push   $0x3a
  jmp __alltraps
c0102dac:	e9 6d 08 00 00       	jmp    c010361e <__alltraps>

c0102db1 <vector59>:
.globl vector59
vector59:
  pushl $0
c0102db1:	6a 00                	push   $0x0
  pushl $59
c0102db3:	6a 3b                	push   $0x3b
  jmp __alltraps
c0102db5:	e9 64 08 00 00       	jmp    c010361e <__alltraps>

c0102dba <vector60>:
.globl vector60
vector60:
  pushl $0
c0102dba:	6a 00                	push   $0x0
  pushl $60
c0102dbc:	6a 3c                	push   $0x3c
  jmp __alltraps
c0102dbe:	e9 5b 08 00 00       	jmp    c010361e <__alltraps>

c0102dc3 <vector61>:
.globl vector61
vector61:
  pushl $0
c0102dc3:	6a 00                	push   $0x0
  pushl $61
c0102dc5:	6a 3d                	push   $0x3d
  jmp __alltraps
c0102dc7:	e9 52 08 00 00       	jmp    c010361e <__alltraps>

c0102dcc <vector62>:
.globl vector62
vector62:
  pushl $0
c0102dcc:	6a 00                	push   $0x0
  pushl $62
c0102dce:	6a 3e                	push   $0x3e
  jmp __alltraps
c0102dd0:	e9 49 08 00 00       	jmp    c010361e <__alltraps>

c0102dd5 <vector63>:
.globl vector63
vector63:
  pushl $0
c0102dd5:	6a 00                	push   $0x0
  pushl $63
c0102dd7:	6a 3f                	push   $0x3f
  jmp __alltraps
c0102dd9:	e9 40 08 00 00       	jmp    c010361e <__alltraps>

c0102dde <vector64>:
.globl vector64
vector64:
  pushl $0
c0102dde:	6a 00                	push   $0x0
  pushl $64
c0102de0:	6a 40                	push   $0x40
  jmp __alltraps
c0102de2:	e9 37 08 00 00       	jmp    c010361e <__alltraps>

c0102de7 <vector65>:
.globl vector65
vector65:
  pushl $0
c0102de7:	6a 00                	push   $0x0
  pushl $65
c0102de9:	6a 41                	push   $0x41
  jmp __alltraps
c0102deb:	e9 2e 08 00 00       	jmp    c010361e <__alltraps>

c0102df0 <vector66>:
.globl vector66
vector66:
  pushl $0
c0102df0:	6a 00                	push   $0x0
  pushl $66
c0102df2:	6a 42                	push   $0x42
  jmp __alltraps
c0102df4:	e9 25 08 00 00       	jmp    c010361e <__alltraps>

c0102df9 <vector67>:
.globl vector67
vector67:
  pushl $0
c0102df9:	6a 00                	push   $0x0
  pushl $67
c0102dfb:	6a 43                	push   $0x43
  jmp __alltraps
c0102dfd:	e9 1c 08 00 00       	jmp    c010361e <__alltraps>

c0102e02 <vector68>:
.globl vector68
vector68:
  pushl $0
c0102e02:	6a 00                	push   $0x0
  pushl $68
c0102e04:	6a 44                	push   $0x44
  jmp __alltraps
c0102e06:	e9 13 08 00 00       	jmp    c010361e <__alltraps>

c0102e0b <vector69>:
.globl vector69
vector69:
  pushl $0
c0102e0b:	6a 00                	push   $0x0
  pushl $69
c0102e0d:	6a 45                	push   $0x45
  jmp __alltraps
c0102e0f:	e9 0a 08 00 00       	jmp    c010361e <__alltraps>

c0102e14 <vector70>:
.globl vector70
vector70:
  pushl $0
c0102e14:	6a 00                	push   $0x0
  pushl $70
c0102e16:	6a 46                	push   $0x46
  jmp __alltraps
c0102e18:	e9 01 08 00 00       	jmp    c010361e <__alltraps>

c0102e1d <vector71>:
.globl vector71
vector71:
  pushl $0
c0102e1d:	6a 00                	push   $0x0
  pushl $71
c0102e1f:	6a 47                	push   $0x47
  jmp __alltraps
c0102e21:	e9 f8 07 00 00       	jmp    c010361e <__alltraps>

c0102e26 <vector72>:
.globl vector72
vector72:
  pushl $0
c0102e26:	6a 00                	push   $0x0
  pushl $72
c0102e28:	6a 48                	push   $0x48
  jmp __alltraps
c0102e2a:	e9 ef 07 00 00       	jmp    c010361e <__alltraps>

c0102e2f <vector73>:
.globl vector73
vector73:
  pushl $0
c0102e2f:	6a 00                	push   $0x0
  pushl $73
c0102e31:	6a 49                	push   $0x49
  jmp __alltraps
c0102e33:	e9 e6 07 00 00       	jmp    c010361e <__alltraps>

c0102e38 <vector74>:
.globl vector74
vector74:
  pushl $0
c0102e38:	6a 00                	push   $0x0
  pushl $74
c0102e3a:	6a 4a                	push   $0x4a
  jmp __alltraps
c0102e3c:	e9 dd 07 00 00       	jmp    c010361e <__alltraps>

c0102e41 <vector75>:
.globl vector75
vector75:
  pushl $0
c0102e41:	6a 00                	push   $0x0
  pushl $75
c0102e43:	6a 4b                	push   $0x4b
  jmp __alltraps
c0102e45:	e9 d4 07 00 00       	jmp    c010361e <__alltraps>

c0102e4a <vector76>:
.globl vector76
vector76:
  pushl $0
c0102e4a:	6a 00                	push   $0x0
  pushl $76
c0102e4c:	6a 4c                	push   $0x4c
  jmp __alltraps
c0102e4e:	e9 cb 07 00 00       	jmp    c010361e <__alltraps>

c0102e53 <vector77>:
.globl vector77
vector77:
  pushl $0
c0102e53:	6a 00                	push   $0x0
  pushl $77
c0102e55:	6a 4d                	push   $0x4d
  jmp __alltraps
c0102e57:	e9 c2 07 00 00       	jmp    c010361e <__alltraps>

c0102e5c <vector78>:
.globl vector78
vector78:
  pushl $0
c0102e5c:	6a 00                	push   $0x0
  pushl $78
c0102e5e:	6a 4e                	push   $0x4e
  jmp __alltraps
c0102e60:	e9 b9 07 00 00       	jmp    c010361e <__alltraps>

c0102e65 <vector79>:
.globl vector79
vector79:
  pushl $0
c0102e65:	6a 00                	push   $0x0
  pushl $79
c0102e67:	6a 4f                	push   $0x4f
  jmp __alltraps
c0102e69:	e9 b0 07 00 00       	jmp    c010361e <__alltraps>

c0102e6e <vector80>:
.globl vector80
vector80:
  pushl $0
c0102e6e:	6a 00                	push   $0x0
  pushl $80
c0102e70:	6a 50                	push   $0x50
  jmp __alltraps
c0102e72:	e9 a7 07 00 00       	jmp    c010361e <__alltraps>

c0102e77 <vector81>:
.globl vector81
vector81:
  pushl $0
c0102e77:	6a 00                	push   $0x0
  pushl $81
c0102e79:	6a 51                	push   $0x51
  jmp __alltraps
c0102e7b:	e9 9e 07 00 00       	jmp    c010361e <__alltraps>

c0102e80 <vector82>:
.globl vector82
vector82:
  pushl $0
c0102e80:	6a 00                	push   $0x0
  pushl $82
c0102e82:	6a 52                	push   $0x52
  jmp __alltraps
c0102e84:	e9 95 07 00 00       	jmp    c010361e <__alltraps>

c0102e89 <vector83>:
.globl vector83
vector83:
  pushl $0
c0102e89:	6a 00                	push   $0x0
  pushl $83
c0102e8b:	6a 53                	push   $0x53
  jmp __alltraps
c0102e8d:	e9 8c 07 00 00       	jmp    c010361e <__alltraps>

c0102e92 <vector84>:
.globl vector84
vector84:
  pushl $0
c0102e92:	6a 00                	push   $0x0
  pushl $84
c0102e94:	6a 54                	push   $0x54
  jmp __alltraps
c0102e96:	e9 83 07 00 00       	jmp    c010361e <__alltraps>

c0102e9b <vector85>:
.globl vector85
vector85:
  pushl $0
c0102e9b:	6a 00                	push   $0x0
  pushl $85
c0102e9d:	6a 55                	push   $0x55
  jmp __alltraps
c0102e9f:	e9 7a 07 00 00       	jmp    c010361e <__alltraps>

c0102ea4 <vector86>:
.globl vector86
vector86:
  pushl $0
c0102ea4:	6a 00                	push   $0x0
  pushl $86
c0102ea6:	6a 56                	push   $0x56
  jmp __alltraps
c0102ea8:	e9 71 07 00 00       	jmp    c010361e <__alltraps>

c0102ead <vector87>:
.globl vector87
vector87:
  pushl $0
c0102ead:	6a 00                	push   $0x0
  pushl $87
c0102eaf:	6a 57                	push   $0x57
  jmp __alltraps
c0102eb1:	e9 68 07 00 00       	jmp    c010361e <__alltraps>

c0102eb6 <vector88>:
.globl vector88
vector88:
  pushl $0
c0102eb6:	6a 00                	push   $0x0
  pushl $88
c0102eb8:	6a 58                	push   $0x58
  jmp __alltraps
c0102eba:	e9 5f 07 00 00       	jmp    c010361e <__alltraps>

c0102ebf <vector89>:
.globl vector89
vector89:
  pushl $0
c0102ebf:	6a 00                	push   $0x0
  pushl $89
c0102ec1:	6a 59                	push   $0x59
  jmp __alltraps
c0102ec3:	e9 56 07 00 00       	jmp    c010361e <__alltraps>

c0102ec8 <vector90>:
.globl vector90
vector90:
  pushl $0
c0102ec8:	6a 00                	push   $0x0
  pushl $90
c0102eca:	6a 5a                	push   $0x5a
  jmp __alltraps
c0102ecc:	e9 4d 07 00 00       	jmp    c010361e <__alltraps>

c0102ed1 <vector91>:
.globl vector91
vector91:
  pushl $0
c0102ed1:	6a 00                	push   $0x0
  pushl $91
c0102ed3:	6a 5b                	push   $0x5b
  jmp __alltraps
c0102ed5:	e9 44 07 00 00       	jmp    c010361e <__alltraps>

c0102eda <vector92>:
.globl vector92
vector92:
  pushl $0
c0102eda:	6a 00                	push   $0x0
  pushl $92
c0102edc:	6a 5c                	push   $0x5c
  jmp __alltraps
c0102ede:	e9 3b 07 00 00       	jmp    c010361e <__alltraps>

c0102ee3 <vector93>:
.globl vector93
vector93:
  pushl $0
c0102ee3:	6a 00                	push   $0x0
  pushl $93
c0102ee5:	6a 5d                	push   $0x5d
  jmp __alltraps
c0102ee7:	e9 32 07 00 00       	jmp    c010361e <__alltraps>

c0102eec <vector94>:
.globl vector94
vector94:
  pushl $0
c0102eec:	6a 00                	push   $0x0
  pushl $94
c0102eee:	6a 5e                	push   $0x5e
  jmp __alltraps
c0102ef0:	e9 29 07 00 00       	jmp    c010361e <__alltraps>

c0102ef5 <vector95>:
.globl vector95
vector95:
  pushl $0
c0102ef5:	6a 00                	push   $0x0
  pushl $95
c0102ef7:	6a 5f                	push   $0x5f
  jmp __alltraps
c0102ef9:	e9 20 07 00 00       	jmp    c010361e <__alltraps>

c0102efe <vector96>:
.globl vector96
vector96:
  pushl $0
c0102efe:	6a 00                	push   $0x0
  pushl $96
c0102f00:	6a 60                	push   $0x60
  jmp __alltraps
c0102f02:	e9 17 07 00 00       	jmp    c010361e <__alltraps>

c0102f07 <vector97>:
.globl vector97
vector97:
  pushl $0
c0102f07:	6a 00                	push   $0x0
  pushl $97
c0102f09:	6a 61                	push   $0x61
  jmp __alltraps
c0102f0b:	e9 0e 07 00 00       	jmp    c010361e <__alltraps>

c0102f10 <vector98>:
.globl vector98
vector98:
  pushl $0
c0102f10:	6a 00                	push   $0x0
  pushl $98
c0102f12:	6a 62                	push   $0x62
  jmp __alltraps
c0102f14:	e9 05 07 00 00       	jmp    c010361e <__alltraps>

c0102f19 <vector99>:
.globl vector99
vector99:
  pushl $0
c0102f19:	6a 00                	push   $0x0
  pushl $99
c0102f1b:	6a 63                	push   $0x63
  jmp __alltraps
c0102f1d:	e9 fc 06 00 00       	jmp    c010361e <__alltraps>

c0102f22 <vector100>:
.globl vector100
vector100:
  pushl $0
c0102f22:	6a 00                	push   $0x0
  pushl $100
c0102f24:	6a 64                	push   $0x64
  jmp __alltraps
c0102f26:	e9 f3 06 00 00       	jmp    c010361e <__alltraps>

c0102f2b <vector101>:
.globl vector101
vector101:
  pushl $0
c0102f2b:	6a 00                	push   $0x0
  pushl $101
c0102f2d:	6a 65                	push   $0x65
  jmp __alltraps
c0102f2f:	e9 ea 06 00 00       	jmp    c010361e <__alltraps>

c0102f34 <vector102>:
.globl vector102
vector102:
  pushl $0
c0102f34:	6a 00                	push   $0x0
  pushl $102
c0102f36:	6a 66                	push   $0x66
  jmp __alltraps
c0102f38:	e9 e1 06 00 00       	jmp    c010361e <__alltraps>

c0102f3d <vector103>:
.globl vector103
vector103:
  pushl $0
c0102f3d:	6a 00                	push   $0x0
  pushl $103
c0102f3f:	6a 67                	push   $0x67
  jmp __alltraps
c0102f41:	e9 d8 06 00 00       	jmp    c010361e <__alltraps>

c0102f46 <vector104>:
.globl vector104
vector104:
  pushl $0
c0102f46:	6a 00                	push   $0x0
  pushl $104
c0102f48:	6a 68                	push   $0x68
  jmp __alltraps
c0102f4a:	e9 cf 06 00 00       	jmp    c010361e <__alltraps>

c0102f4f <vector105>:
.globl vector105
vector105:
  pushl $0
c0102f4f:	6a 00                	push   $0x0
  pushl $105
c0102f51:	6a 69                	push   $0x69
  jmp __alltraps
c0102f53:	e9 c6 06 00 00       	jmp    c010361e <__alltraps>

c0102f58 <vector106>:
.globl vector106
vector106:
  pushl $0
c0102f58:	6a 00                	push   $0x0
  pushl $106
c0102f5a:	6a 6a                	push   $0x6a
  jmp __alltraps
c0102f5c:	e9 bd 06 00 00       	jmp    c010361e <__alltraps>

c0102f61 <vector107>:
.globl vector107
vector107:
  pushl $0
c0102f61:	6a 00                	push   $0x0
  pushl $107
c0102f63:	6a 6b                	push   $0x6b
  jmp __alltraps
c0102f65:	e9 b4 06 00 00       	jmp    c010361e <__alltraps>

c0102f6a <vector108>:
.globl vector108
vector108:
  pushl $0
c0102f6a:	6a 00                	push   $0x0
  pushl $108
c0102f6c:	6a 6c                	push   $0x6c
  jmp __alltraps
c0102f6e:	e9 ab 06 00 00       	jmp    c010361e <__alltraps>

c0102f73 <vector109>:
.globl vector109
vector109:
  pushl $0
c0102f73:	6a 00                	push   $0x0
  pushl $109
c0102f75:	6a 6d                	push   $0x6d
  jmp __alltraps
c0102f77:	e9 a2 06 00 00       	jmp    c010361e <__alltraps>

c0102f7c <vector110>:
.globl vector110
vector110:
  pushl $0
c0102f7c:	6a 00                	push   $0x0
  pushl $110
c0102f7e:	6a 6e                	push   $0x6e
  jmp __alltraps
c0102f80:	e9 99 06 00 00       	jmp    c010361e <__alltraps>

c0102f85 <vector111>:
.globl vector111
vector111:
  pushl $0
c0102f85:	6a 00                	push   $0x0
  pushl $111
c0102f87:	6a 6f                	push   $0x6f
  jmp __alltraps
c0102f89:	e9 90 06 00 00       	jmp    c010361e <__alltraps>

c0102f8e <vector112>:
.globl vector112
vector112:
  pushl $0
c0102f8e:	6a 00                	push   $0x0
  pushl $112
c0102f90:	6a 70                	push   $0x70
  jmp __alltraps
c0102f92:	e9 87 06 00 00       	jmp    c010361e <__alltraps>

c0102f97 <vector113>:
.globl vector113
vector113:
  pushl $0
c0102f97:	6a 00                	push   $0x0
  pushl $113
c0102f99:	6a 71                	push   $0x71
  jmp __alltraps
c0102f9b:	e9 7e 06 00 00       	jmp    c010361e <__alltraps>

c0102fa0 <vector114>:
.globl vector114
vector114:
  pushl $0
c0102fa0:	6a 00                	push   $0x0
  pushl $114
c0102fa2:	6a 72                	push   $0x72
  jmp __alltraps
c0102fa4:	e9 75 06 00 00       	jmp    c010361e <__alltraps>

c0102fa9 <vector115>:
.globl vector115
vector115:
  pushl $0
c0102fa9:	6a 00                	push   $0x0
  pushl $115
c0102fab:	6a 73                	push   $0x73
  jmp __alltraps
c0102fad:	e9 6c 06 00 00       	jmp    c010361e <__alltraps>

c0102fb2 <vector116>:
.globl vector116
vector116:
  pushl $0
c0102fb2:	6a 00                	push   $0x0
  pushl $116
c0102fb4:	6a 74                	push   $0x74
  jmp __alltraps
c0102fb6:	e9 63 06 00 00       	jmp    c010361e <__alltraps>

c0102fbb <vector117>:
.globl vector117
vector117:
  pushl $0
c0102fbb:	6a 00                	push   $0x0
  pushl $117
c0102fbd:	6a 75                	push   $0x75
  jmp __alltraps
c0102fbf:	e9 5a 06 00 00       	jmp    c010361e <__alltraps>

c0102fc4 <vector118>:
.globl vector118
vector118:
  pushl $0
c0102fc4:	6a 00                	push   $0x0
  pushl $118
c0102fc6:	6a 76                	push   $0x76
  jmp __alltraps
c0102fc8:	e9 51 06 00 00       	jmp    c010361e <__alltraps>

c0102fcd <vector119>:
.globl vector119
vector119:
  pushl $0
c0102fcd:	6a 00                	push   $0x0
  pushl $119
c0102fcf:	6a 77                	push   $0x77
  jmp __alltraps
c0102fd1:	e9 48 06 00 00       	jmp    c010361e <__alltraps>

c0102fd6 <vector120>:
.globl vector120
vector120:
  pushl $0
c0102fd6:	6a 00                	push   $0x0
  pushl $120
c0102fd8:	6a 78                	push   $0x78
  jmp __alltraps
c0102fda:	e9 3f 06 00 00       	jmp    c010361e <__alltraps>

c0102fdf <vector121>:
.globl vector121
vector121:
  pushl $0
c0102fdf:	6a 00                	push   $0x0
  pushl $121
c0102fe1:	6a 79                	push   $0x79
  jmp __alltraps
c0102fe3:	e9 36 06 00 00       	jmp    c010361e <__alltraps>

c0102fe8 <vector122>:
.globl vector122
vector122:
  pushl $0
c0102fe8:	6a 00                	push   $0x0
  pushl $122
c0102fea:	6a 7a                	push   $0x7a
  jmp __alltraps
c0102fec:	e9 2d 06 00 00       	jmp    c010361e <__alltraps>

c0102ff1 <vector123>:
.globl vector123
vector123:
  pushl $0
c0102ff1:	6a 00                	push   $0x0
  pushl $123
c0102ff3:	6a 7b                	push   $0x7b
  jmp __alltraps
c0102ff5:	e9 24 06 00 00       	jmp    c010361e <__alltraps>

c0102ffa <vector124>:
.globl vector124
vector124:
  pushl $0
c0102ffa:	6a 00                	push   $0x0
  pushl $124
c0102ffc:	6a 7c                	push   $0x7c
  jmp __alltraps
c0102ffe:	e9 1b 06 00 00       	jmp    c010361e <__alltraps>

c0103003 <vector125>:
.globl vector125
vector125:
  pushl $0
c0103003:	6a 00                	push   $0x0
  pushl $125
c0103005:	6a 7d                	push   $0x7d
  jmp __alltraps
c0103007:	e9 12 06 00 00       	jmp    c010361e <__alltraps>

c010300c <vector126>:
.globl vector126
vector126:
  pushl $0
c010300c:	6a 00                	push   $0x0
  pushl $126
c010300e:	6a 7e                	push   $0x7e
  jmp __alltraps
c0103010:	e9 09 06 00 00       	jmp    c010361e <__alltraps>

c0103015 <vector127>:
.globl vector127
vector127:
  pushl $0
c0103015:	6a 00                	push   $0x0
  pushl $127
c0103017:	6a 7f                	push   $0x7f
  jmp __alltraps
c0103019:	e9 00 06 00 00       	jmp    c010361e <__alltraps>

c010301e <vector128>:
.globl vector128
vector128:
  pushl $0
c010301e:	6a 00                	push   $0x0
  pushl $128
c0103020:	68 80 00 00 00       	push   $0x80
  jmp __alltraps
c0103025:	e9 f4 05 00 00       	jmp    c010361e <__alltraps>

c010302a <vector129>:
.globl vector129
vector129:
  pushl $0
c010302a:	6a 00                	push   $0x0
  pushl $129
c010302c:	68 81 00 00 00       	push   $0x81
  jmp __alltraps
c0103031:	e9 e8 05 00 00       	jmp    c010361e <__alltraps>

c0103036 <vector130>:
.globl vector130
vector130:
  pushl $0
c0103036:	6a 00                	push   $0x0
  pushl $130
c0103038:	68 82 00 00 00       	push   $0x82
  jmp __alltraps
c010303d:	e9 dc 05 00 00       	jmp    c010361e <__alltraps>

c0103042 <vector131>:
.globl vector131
vector131:
  pushl $0
c0103042:	6a 00                	push   $0x0
  pushl $131
c0103044:	68 83 00 00 00       	push   $0x83
  jmp __alltraps
c0103049:	e9 d0 05 00 00       	jmp    c010361e <__alltraps>

c010304e <vector132>:
.globl vector132
vector132:
  pushl $0
c010304e:	6a 00                	push   $0x0
  pushl $132
c0103050:	68 84 00 00 00       	push   $0x84
  jmp __alltraps
c0103055:	e9 c4 05 00 00       	jmp    c010361e <__alltraps>

c010305a <vector133>:
.globl vector133
vector133:
  pushl $0
c010305a:	6a 00                	push   $0x0
  pushl $133
c010305c:	68 85 00 00 00       	push   $0x85
  jmp __alltraps
c0103061:	e9 b8 05 00 00       	jmp    c010361e <__alltraps>

c0103066 <vector134>:
.globl vector134
vector134:
  pushl $0
c0103066:	6a 00                	push   $0x0
  pushl $134
c0103068:	68 86 00 00 00       	push   $0x86
  jmp __alltraps
c010306d:	e9 ac 05 00 00       	jmp    c010361e <__alltraps>

c0103072 <vector135>:
.globl vector135
vector135:
  pushl $0
c0103072:	6a 00                	push   $0x0
  pushl $135
c0103074:	68 87 00 00 00       	push   $0x87
  jmp __alltraps
c0103079:	e9 a0 05 00 00       	jmp    c010361e <__alltraps>

c010307e <vector136>:
.globl vector136
vector136:
  pushl $0
c010307e:	6a 00                	push   $0x0
  pushl $136
c0103080:	68 88 00 00 00       	push   $0x88
  jmp __alltraps
c0103085:	e9 94 05 00 00       	jmp    c010361e <__alltraps>

c010308a <vector137>:
.globl vector137
vector137:
  pushl $0
c010308a:	6a 00                	push   $0x0
  pushl $137
c010308c:	68 89 00 00 00       	push   $0x89
  jmp __alltraps
c0103091:	e9 88 05 00 00       	jmp    c010361e <__alltraps>

c0103096 <vector138>:
.globl vector138
vector138:
  pushl $0
c0103096:	6a 00                	push   $0x0
  pushl $138
c0103098:	68 8a 00 00 00       	push   $0x8a
  jmp __alltraps
c010309d:	e9 7c 05 00 00       	jmp    c010361e <__alltraps>

c01030a2 <vector139>:
.globl vector139
vector139:
  pushl $0
c01030a2:	6a 00                	push   $0x0
  pushl $139
c01030a4:	68 8b 00 00 00       	push   $0x8b
  jmp __alltraps
c01030a9:	e9 70 05 00 00       	jmp    c010361e <__alltraps>

c01030ae <vector140>:
.globl vector140
vector140:
  pushl $0
c01030ae:	6a 00                	push   $0x0
  pushl $140
c01030b0:	68 8c 00 00 00       	push   $0x8c
  jmp __alltraps
c01030b5:	e9 64 05 00 00       	jmp    c010361e <__alltraps>

c01030ba <vector141>:
.globl vector141
vector141:
  pushl $0
c01030ba:	6a 00                	push   $0x0
  pushl $141
c01030bc:	68 8d 00 00 00       	push   $0x8d
  jmp __alltraps
c01030c1:	e9 58 05 00 00       	jmp    c010361e <__alltraps>

c01030c6 <vector142>:
.globl vector142
vector142:
  pushl $0
c01030c6:	6a 00                	push   $0x0
  pushl $142
c01030c8:	68 8e 00 00 00       	push   $0x8e
  jmp __alltraps
c01030cd:	e9 4c 05 00 00       	jmp    c010361e <__alltraps>

c01030d2 <vector143>:
.globl vector143
vector143:
  pushl $0
c01030d2:	6a 00                	push   $0x0
  pushl $143
c01030d4:	68 8f 00 00 00       	push   $0x8f
  jmp __alltraps
c01030d9:	e9 40 05 00 00       	jmp    c010361e <__alltraps>

c01030de <vector144>:
.globl vector144
vector144:
  pushl $0
c01030de:	6a 00                	push   $0x0
  pushl $144
c01030e0:	68 90 00 00 00       	push   $0x90
  jmp __alltraps
c01030e5:	e9 34 05 00 00       	jmp    c010361e <__alltraps>

c01030ea <vector145>:
.globl vector145
vector145:
  pushl $0
c01030ea:	6a 00                	push   $0x0
  pushl $145
c01030ec:	68 91 00 00 00       	push   $0x91
  jmp __alltraps
c01030f1:	e9 28 05 00 00       	jmp    c010361e <__alltraps>

c01030f6 <vector146>:
.globl vector146
vector146:
  pushl $0
c01030f6:	6a 00                	push   $0x0
  pushl $146
c01030f8:	68 92 00 00 00       	push   $0x92
  jmp __alltraps
c01030fd:	e9 1c 05 00 00       	jmp    c010361e <__alltraps>

c0103102 <vector147>:
.globl vector147
vector147:
  pushl $0
c0103102:	6a 00                	push   $0x0
  pushl $147
c0103104:	68 93 00 00 00       	push   $0x93
  jmp __alltraps
c0103109:	e9 10 05 00 00       	jmp    c010361e <__alltraps>

c010310e <vector148>:
.globl vector148
vector148:
  pushl $0
c010310e:	6a 00                	push   $0x0
  pushl $148
c0103110:	68 94 00 00 00       	push   $0x94
  jmp __alltraps
c0103115:	e9 04 05 00 00       	jmp    c010361e <__alltraps>

c010311a <vector149>:
.globl vector149
vector149:
  pushl $0
c010311a:	6a 00                	push   $0x0
  pushl $149
c010311c:	68 95 00 00 00       	push   $0x95
  jmp __alltraps
c0103121:	e9 f8 04 00 00       	jmp    c010361e <__alltraps>

c0103126 <vector150>:
.globl vector150
vector150:
  pushl $0
c0103126:	6a 00                	push   $0x0
  pushl $150
c0103128:	68 96 00 00 00       	push   $0x96
  jmp __alltraps
c010312d:	e9 ec 04 00 00       	jmp    c010361e <__alltraps>

c0103132 <vector151>:
.globl vector151
vector151:
  pushl $0
c0103132:	6a 00                	push   $0x0
  pushl $151
c0103134:	68 97 00 00 00       	push   $0x97
  jmp __alltraps
c0103139:	e9 e0 04 00 00       	jmp    c010361e <__alltraps>

c010313e <vector152>:
.globl vector152
vector152:
  pushl $0
c010313e:	6a 00                	push   $0x0
  pushl $152
c0103140:	68 98 00 00 00       	push   $0x98
  jmp __alltraps
c0103145:	e9 d4 04 00 00       	jmp    c010361e <__alltraps>

c010314a <vector153>:
.globl vector153
vector153:
  pushl $0
c010314a:	6a 00                	push   $0x0
  pushl $153
c010314c:	68 99 00 00 00       	push   $0x99
  jmp __alltraps
c0103151:	e9 c8 04 00 00       	jmp    c010361e <__alltraps>

c0103156 <vector154>:
.globl vector154
vector154:
  pushl $0
c0103156:	6a 00                	push   $0x0
  pushl $154
c0103158:	68 9a 00 00 00       	push   $0x9a
  jmp __alltraps
c010315d:	e9 bc 04 00 00       	jmp    c010361e <__alltraps>

c0103162 <vector155>:
.globl vector155
vector155:
  pushl $0
c0103162:	6a 00                	push   $0x0
  pushl $155
c0103164:	68 9b 00 00 00       	push   $0x9b
  jmp __alltraps
c0103169:	e9 b0 04 00 00       	jmp    c010361e <__alltraps>

c010316e <vector156>:
.globl vector156
vector156:
  pushl $0
c010316e:	6a 00                	push   $0x0
  pushl $156
c0103170:	68 9c 00 00 00       	push   $0x9c
  jmp __alltraps
c0103175:	e9 a4 04 00 00       	jmp    c010361e <__alltraps>

c010317a <vector157>:
.globl vector157
vector157:
  pushl $0
c010317a:	6a 00                	push   $0x0
  pushl $157
c010317c:	68 9d 00 00 00       	push   $0x9d
  jmp __alltraps
c0103181:	e9 98 04 00 00       	jmp    c010361e <__alltraps>

c0103186 <vector158>:
.globl vector158
vector158:
  pushl $0
c0103186:	6a 00                	push   $0x0
  pushl $158
c0103188:	68 9e 00 00 00       	push   $0x9e
  jmp __alltraps
c010318d:	e9 8c 04 00 00       	jmp    c010361e <__alltraps>

c0103192 <vector159>:
.globl vector159
vector159:
  pushl $0
c0103192:	6a 00                	push   $0x0
  pushl $159
c0103194:	68 9f 00 00 00       	push   $0x9f
  jmp __alltraps
c0103199:	e9 80 04 00 00       	jmp    c010361e <__alltraps>

c010319e <vector160>:
.globl vector160
vector160:
  pushl $0
c010319e:	6a 00                	push   $0x0
  pushl $160
c01031a0:	68 a0 00 00 00       	push   $0xa0
  jmp __alltraps
c01031a5:	e9 74 04 00 00       	jmp    c010361e <__alltraps>

c01031aa <vector161>:
.globl vector161
vector161:
  pushl $0
c01031aa:	6a 00                	push   $0x0
  pushl $161
c01031ac:	68 a1 00 00 00       	push   $0xa1
  jmp __alltraps
c01031b1:	e9 68 04 00 00       	jmp    c010361e <__alltraps>

c01031b6 <vector162>:
.globl vector162
vector162:
  pushl $0
c01031b6:	6a 00                	push   $0x0
  pushl $162
c01031b8:	68 a2 00 00 00       	push   $0xa2
  jmp __alltraps
c01031bd:	e9 5c 04 00 00       	jmp    c010361e <__alltraps>

c01031c2 <vector163>:
.globl vector163
vector163:
  pushl $0
c01031c2:	6a 00                	push   $0x0
  pushl $163
c01031c4:	68 a3 00 00 00       	push   $0xa3
  jmp __alltraps
c01031c9:	e9 50 04 00 00       	jmp    c010361e <__alltraps>

c01031ce <vector164>:
.globl vector164
vector164:
  pushl $0
c01031ce:	6a 00                	push   $0x0
  pushl $164
c01031d0:	68 a4 00 00 00       	push   $0xa4
  jmp __alltraps
c01031d5:	e9 44 04 00 00       	jmp    c010361e <__alltraps>

c01031da <vector165>:
.globl vector165
vector165:
  pushl $0
c01031da:	6a 00                	push   $0x0
  pushl $165
c01031dc:	68 a5 00 00 00       	push   $0xa5
  jmp __alltraps
c01031e1:	e9 38 04 00 00       	jmp    c010361e <__alltraps>

c01031e6 <vector166>:
.globl vector166
vector166:
  pushl $0
c01031e6:	6a 00                	push   $0x0
  pushl $166
c01031e8:	68 a6 00 00 00       	push   $0xa6
  jmp __alltraps
c01031ed:	e9 2c 04 00 00       	jmp    c010361e <__alltraps>

c01031f2 <vector167>:
.globl vector167
vector167:
  pushl $0
c01031f2:	6a 00                	push   $0x0
  pushl $167
c01031f4:	68 a7 00 00 00       	push   $0xa7
  jmp __alltraps
c01031f9:	e9 20 04 00 00       	jmp    c010361e <__alltraps>

c01031fe <vector168>:
.globl vector168
vector168:
  pushl $0
c01031fe:	6a 00                	push   $0x0
  pushl $168
c0103200:	68 a8 00 00 00       	push   $0xa8
  jmp __alltraps
c0103205:	e9 14 04 00 00       	jmp    c010361e <__alltraps>

c010320a <vector169>:
.globl vector169
vector169:
  pushl $0
c010320a:	6a 00                	push   $0x0
  pushl $169
c010320c:	68 a9 00 00 00       	push   $0xa9
  jmp __alltraps
c0103211:	e9 08 04 00 00       	jmp    c010361e <__alltraps>

c0103216 <vector170>:
.globl vector170
vector170:
  pushl $0
c0103216:	6a 00                	push   $0x0
  pushl $170
c0103218:	68 aa 00 00 00       	push   $0xaa
  jmp __alltraps
c010321d:	e9 fc 03 00 00       	jmp    c010361e <__alltraps>

c0103222 <vector171>:
.globl vector171
vector171:
  pushl $0
c0103222:	6a 00                	push   $0x0
  pushl $171
c0103224:	68 ab 00 00 00       	push   $0xab
  jmp __alltraps
c0103229:	e9 f0 03 00 00       	jmp    c010361e <__alltraps>

c010322e <vector172>:
.globl vector172
vector172:
  pushl $0
c010322e:	6a 00                	push   $0x0
  pushl $172
c0103230:	68 ac 00 00 00       	push   $0xac
  jmp __alltraps
c0103235:	e9 e4 03 00 00       	jmp    c010361e <__alltraps>

c010323a <vector173>:
.globl vector173
vector173:
  pushl $0
c010323a:	6a 00                	push   $0x0
  pushl $173
c010323c:	68 ad 00 00 00       	push   $0xad
  jmp __alltraps
c0103241:	e9 d8 03 00 00       	jmp    c010361e <__alltraps>

c0103246 <vector174>:
.globl vector174
vector174:
  pushl $0
c0103246:	6a 00                	push   $0x0
  pushl $174
c0103248:	68 ae 00 00 00       	push   $0xae
  jmp __alltraps
c010324d:	e9 cc 03 00 00       	jmp    c010361e <__alltraps>

c0103252 <vector175>:
.globl vector175
vector175:
  pushl $0
c0103252:	6a 00                	push   $0x0
  pushl $175
c0103254:	68 af 00 00 00       	push   $0xaf
  jmp __alltraps
c0103259:	e9 c0 03 00 00       	jmp    c010361e <__alltraps>

c010325e <vector176>:
.globl vector176
vector176:
  pushl $0
c010325e:	6a 00                	push   $0x0
  pushl $176
c0103260:	68 b0 00 00 00       	push   $0xb0
  jmp __alltraps
c0103265:	e9 b4 03 00 00       	jmp    c010361e <__alltraps>

c010326a <vector177>:
.globl vector177
vector177:
  pushl $0
c010326a:	6a 00                	push   $0x0
  pushl $177
c010326c:	68 b1 00 00 00       	push   $0xb1
  jmp __alltraps
c0103271:	e9 a8 03 00 00       	jmp    c010361e <__alltraps>

c0103276 <vector178>:
.globl vector178
vector178:
  pushl $0
c0103276:	6a 00                	push   $0x0
  pushl $178
c0103278:	68 b2 00 00 00       	push   $0xb2
  jmp __alltraps
c010327d:	e9 9c 03 00 00       	jmp    c010361e <__alltraps>

c0103282 <vector179>:
.globl vector179
vector179:
  pushl $0
c0103282:	6a 00                	push   $0x0
  pushl $179
c0103284:	68 b3 00 00 00       	push   $0xb3
  jmp __alltraps
c0103289:	e9 90 03 00 00       	jmp    c010361e <__alltraps>

c010328e <vector180>:
.globl vector180
vector180:
  pushl $0
c010328e:	6a 00                	push   $0x0
  pushl $180
c0103290:	68 b4 00 00 00       	push   $0xb4
  jmp __alltraps
c0103295:	e9 84 03 00 00       	jmp    c010361e <__alltraps>

c010329a <vector181>:
.globl vector181
vector181:
  pushl $0
c010329a:	6a 00                	push   $0x0
  pushl $181
c010329c:	68 b5 00 00 00       	push   $0xb5
  jmp __alltraps
c01032a1:	e9 78 03 00 00       	jmp    c010361e <__alltraps>

c01032a6 <vector182>:
.globl vector182
vector182:
  pushl $0
c01032a6:	6a 00                	push   $0x0
  pushl $182
c01032a8:	68 b6 00 00 00       	push   $0xb6
  jmp __alltraps
c01032ad:	e9 6c 03 00 00       	jmp    c010361e <__alltraps>

c01032b2 <vector183>:
.globl vector183
vector183:
  pushl $0
c01032b2:	6a 00                	push   $0x0
  pushl $183
c01032b4:	68 b7 00 00 00       	push   $0xb7
  jmp __alltraps
c01032b9:	e9 60 03 00 00       	jmp    c010361e <__alltraps>

c01032be <vector184>:
.globl vector184
vector184:
  pushl $0
c01032be:	6a 00                	push   $0x0
  pushl $184
c01032c0:	68 b8 00 00 00       	push   $0xb8
  jmp __alltraps
c01032c5:	e9 54 03 00 00       	jmp    c010361e <__alltraps>

c01032ca <vector185>:
.globl vector185
vector185:
  pushl $0
c01032ca:	6a 00                	push   $0x0
  pushl $185
c01032cc:	68 b9 00 00 00       	push   $0xb9
  jmp __alltraps
c01032d1:	e9 48 03 00 00       	jmp    c010361e <__alltraps>

c01032d6 <vector186>:
.globl vector186
vector186:
  pushl $0
c01032d6:	6a 00                	push   $0x0
  pushl $186
c01032d8:	68 ba 00 00 00       	push   $0xba
  jmp __alltraps
c01032dd:	e9 3c 03 00 00       	jmp    c010361e <__alltraps>

c01032e2 <vector187>:
.globl vector187
vector187:
  pushl $0
c01032e2:	6a 00                	push   $0x0
  pushl $187
c01032e4:	68 bb 00 00 00       	push   $0xbb
  jmp __alltraps
c01032e9:	e9 30 03 00 00       	jmp    c010361e <__alltraps>

c01032ee <vector188>:
.globl vector188
vector188:
  pushl $0
c01032ee:	6a 00                	push   $0x0
  pushl $188
c01032f0:	68 bc 00 00 00       	push   $0xbc
  jmp __alltraps
c01032f5:	e9 24 03 00 00       	jmp    c010361e <__alltraps>

c01032fa <vector189>:
.globl vector189
vector189:
  pushl $0
c01032fa:	6a 00                	push   $0x0
  pushl $189
c01032fc:	68 bd 00 00 00       	push   $0xbd
  jmp __alltraps
c0103301:	e9 18 03 00 00       	jmp    c010361e <__alltraps>

c0103306 <vector190>:
.globl vector190
vector190:
  pushl $0
c0103306:	6a 00                	push   $0x0
  pushl $190
c0103308:	68 be 00 00 00       	push   $0xbe
  jmp __alltraps
c010330d:	e9 0c 03 00 00       	jmp    c010361e <__alltraps>

c0103312 <vector191>:
.globl vector191
vector191:
  pushl $0
c0103312:	6a 00                	push   $0x0
  pushl $191
c0103314:	68 bf 00 00 00       	push   $0xbf
  jmp __alltraps
c0103319:	e9 00 03 00 00       	jmp    c010361e <__alltraps>

c010331e <vector192>:
.globl vector192
vector192:
  pushl $0
c010331e:	6a 00                	push   $0x0
  pushl $192
c0103320:	68 c0 00 00 00       	push   $0xc0
  jmp __alltraps
c0103325:	e9 f4 02 00 00       	jmp    c010361e <__alltraps>

c010332a <vector193>:
.globl vector193
vector193:
  pushl $0
c010332a:	6a 00                	push   $0x0
  pushl $193
c010332c:	68 c1 00 00 00       	push   $0xc1
  jmp __alltraps
c0103331:	e9 e8 02 00 00       	jmp    c010361e <__alltraps>

c0103336 <vector194>:
.globl vector194
vector194:
  pushl $0
c0103336:	6a 00                	push   $0x0
  pushl $194
c0103338:	68 c2 00 00 00       	push   $0xc2
  jmp __alltraps
c010333d:	e9 dc 02 00 00       	jmp    c010361e <__alltraps>

c0103342 <vector195>:
.globl vector195
vector195:
  pushl $0
c0103342:	6a 00                	push   $0x0
  pushl $195
c0103344:	68 c3 00 00 00       	push   $0xc3
  jmp __alltraps
c0103349:	e9 d0 02 00 00       	jmp    c010361e <__alltraps>

c010334e <vector196>:
.globl vector196
vector196:
  pushl $0
c010334e:	6a 00                	push   $0x0
  pushl $196
c0103350:	68 c4 00 00 00       	push   $0xc4
  jmp __alltraps
c0103355:	e9 c4 02 00 00       	jmp    c010361e <__alltraps>

c010335a <vector197>:
.globl vector197
vector197:
  pushl $0
c010335a:	6a 00                	push   $0x0
  pushl $197
c010335c:	68 c5 00 00 00       	push   $0xc5
  jmp __alltraps
c0103361:	e9 b8 02 00 00       	jmp    c010361e <__alltraps>

c0103366 <vector198>:
.globl vector198
vector198:
  pushl $0
c0103366:	6a 00                	push   $0x0
  pushl $198
c0103368:	68 c6 00 00 00       	push   $0xc6
  jmp __alltraps
c010336d:	e9 ac 02 00 00       	jmp    c010361e <__alltraps>

c0103372 <vector199>:
.globl vector199
vector199:
  pushl $0
c0103372:	6a 00                	push   $0x0
  pushl $199
c0103374:	68 c7 00 00 00       	push   $0xc7
  jmp __alltraps
c0103379:	e9 a0 02 00 00       	jmp    c010361e <__alltraps>

c010337e <vector200>:
.globl vector200
vector200:
  pushl $0
c010337e:	6a 00                	push   $0x0
  pushl $200
c0103380:	68 c8 00 00 00       	push   $0xc8
  jmp __alltraps
c0103385:	e9 94 02 00 00       	jmp    c010361e <__alltraps>

c010338a <vector201>:
.globl vector201
vector201:
  pushl $0
c010338a:	6a 00                	push   $0x0
  pushl $201
c010338c:	68 c9 00 00 00       	push   $0xc9
  jmp __alltraps
c0103391:	e9 88 02 00 00       	jmp    c010361e <__alltraps>

c0103396 <vector202>:
.globl vector202
vector202:
  pushl $0
c0103396:	6a 00                	push   $0x0
  pushl $202
c0103398:	68 ca 00 00 00       	push   $0xca
  jmp __alltraps
c010339d:	e9 7c 02 00 00       	jmp    c010361e <__alltraps>

c01033a2 <vector203>:
.globl vector203
vector203:
  pushl $0
c01033a2:	6a 00                	push   $0x0
  pushl $203
c01033a4:	68 cb 00 00 00       	push   $0xcb
  jmp __alltraps
c01033a9:	e9 70 02 00 00       	jmp    c010361e <__alltraps>

c01033ae <vector204>:
.globl vector204
vector204:
  pushl $0
c01033ae:	6a 00                	push   $0x0
  pushl $204
c01033b0:	68 cc 00 00 00       	push   $0xcc
  jmp __alltraps
c01033b5:	e9 64 02 00 00       	jmp    c010361e <__alltraps>

c01033ba <vector205>:
.globl vector205
vector205:
  pushl $0
c01033ba:	6a 00                	push   $0x0
  pushl $205
c01033bc:	68 cd 00 00 00       	push   $0xcd
  jmp __alltraps
c01033c1:	e9 58 02 00 00       	jmp    c010361e <__alltraps>

c01033c6 <vector206>:
.globl vector206
vector206:
  pushl $0
c01033c6:	6a 00                	push   $0x0
  pushl $206
c01033c8:	68 ce 00 00 00       	push   $0xce
  jmp __alltraps
c01033cd:	e9 4c 02 00 00       	jmp    c010361e <__alltraps>

c01033d2 <vector207>:
.globl vector207
vector207:
  pushl $0
c01033d2:	6a 00                	push   $0x0
  pushl $207
c01033d4:	68 cf 00 00 00       	push   $0xcf
  jmp __alltraps
c01033d9:	e9 40 02 00 00       	jmp    c010361e <__alltraps>

c01033de <vector208>:
.globl vector208
vector208:
  pushl $0
c01033de:	6a 00                	push   $0x0
  pushl $208
c01033e0:	68 d0 00 00 00       	push   $0xd0
  jmp __alltraps
c01033e5:	e9 34 02 00 00       	jmp    c010361e <__alltraps>

c01033ea <vector209>:
.globl vector209
vector209:
  pushl $0
c01033ea:	6a 00                	push   $0x0
  pushl $209
c01033ec:	68 d1 00 00 00       	push   $0xd1
  jmp __alltraps
c01033f1:	e9 28 02 00 00       	jmp    c010361e <__alltraps>

c01033f6 <vector210>:
.globl vector210
vector210:
  pushl $0
c01033f6:	6a 00                	push   $0x0
  pushl $210
c01033f8:	68 d2 00 00 00       	push   $0xd2
  jmp __alltraps
c01033fd:	e9 1c 02 00 00       	jmp    c010361e <__alltraps>

c0103402 <vector211>:
.globl vector211
vector211:
  pushl $0
c0103402:	6a 00                	push   $0x0
  pushl $211
c0103404:	68 d3 00 00 00       	push   $0xd3
  jmp __alltraps
c0103409:	e9 10 02 00 00       	jmp    c010361e <__alltraps>

c010340e <vector212>:
.globl vector212
vector212:
  pushl $0
c010340e:	6a 00                	push   $0x0
  pushl $212
c0103410:	68 d4 00 00 00       	push   $0xd4
  jmp __alltraps
c0103415:	e9 04 02 00 00       	jmp    c010361e <__alltraps>

c010341a <vector213>:
.globl vector213
vector213:
  pushl $0
c010341a:	6a 00                	push   $0x0
  pushl $213
c010341c:	68 d5 00 00 00       	push   $0xd5
  jmp __alltraps
c0103421:	e9 f8 01 00 00       	jmp    c010361e <__alltraps>

c0103426 <vector214>:
.globl vector214
vector214:
  pushl $0
c0103426:	6a 00                	push   $0x0
  pushl $214
c0103428:	68 d6 00 00 00       	push   $0xd6
  jmp __alltraps
c010342d:	e9 ec 01 00 00       	jmp    c010361e <__alltraps>

c0103432 <vector215>:
.globl vector215
vector215:
  pushl $0
c0103432:	6a 00                	push   $0x0
  pushl $215
c0103434:	68 d7 00 00 00       	push   $0xd7
  jmp __alltraps
c0103439:	e9 e0 01 00 00       	jmp    c010361e <__alltraps>

c010343e <vector216>:
.globl vector216
vector216:
  pushl $0
c010343e:	6a 00                	push   $0x0
  pushl $216
c0103440:	68 d8 00 00 00       	push   $0xd8
  jmp __alltraps
c0103445:	e9 d4 01 00 00       	jmp    c010361e <__alltraps>

c010344a <vector217>:
.globl vector217
vector217:
  pushl $0
c010344a:	6a 00                	push   $0x0
  pushl $217
c010344c:	68 d9 00 00 00       	push   $0xd9
  jmp __alltraps
c0103451:	e9 c8 01 00 00       	jmp    c010361e <__alltraps>

c0103456 <vector218>:
.globl vector218
vector218:
  pushl $0
c0103456:	6a 00                	push   $0x0
  pushl $218
c0103458:	68 da 00 00 00       	push   $0xda
  jmp __alltraps
c010345d:	e9 bc 01 00 00       	jmp    c010361e <__alltraps>

c0103462 <vector219>:
.globl vector219
vector219:
  pushl $0
c0103462:	6a 00                	push   $0x0
  pushl $219
c0103464:	68 db 00 00 00       	push   $0xdb
  jmp __alltraps
c0103469:	e9 b0 01 00 00       	jmp    c010361e <__alltraps>

c010346e <vector220>:
.globl vector220
vector220:
  pushl $0
c010346e:	6a 00                	push   $0x0
  pushl $220
c0103470:	68 dc 00 00 00       	push   $0xdc
  jmp __alltraps
c0103475:	e9 a4 01 00 00       	jmp    c010361e <__alltraps>

c010347a <vector221>:
.globl vector221
vector221:
  pushl $0
c010347a:	6a 00                	push   $0x0
  pushl $221
c010347c:	68 dd 00 00 00       	push   $0xdd
  jmp __alltraps
c0103481:	e9 98 01 00 00       	jmp    c010361e <__alltraps>

c0103486 <vector222>:
.globl vector222
vector222:
  pushl $0
c0103486:	6a 00                	push   $0x0
  pushl $222
c0103488:	68 de 00 00 00       	push   $0xde
  jmp __alltraps
c010348d:	e9 8c 01 00 00       	jmp    c010361e <__alltraps>

c0103492 <vector223>:
.globl vector223
vector223:
  pushl $0
c0103492:	6a 00                	push   $0x0
  pushl $223
c0103494:	68 df 00 00 00       	push   $0xdf
  jmp __alltraps
c0103499:	e9 80 01 00 00       	jmp    c010361e <__alltraps>

c010349e <vector224>:
.globl vector224
vector224:
  pushl $0
c010349e:	6a 00                	push   $0x0
  pushl $224
c01034a0:	68 e0 00 00 00       	push   $0xe0
  jmp __alltraps
c01034a5:	e9 74 01 00 00       	jmp    c010361e <__alltraps>

c01034aa <vector225>:
.globl vector225
vector225:
  pushl $0
c01034aa:	6a 00                	push   $0x0
  pushl $225
c01034ac:	68 e1 00 00 00       	push   $0xe1
  jmp __alltraps
c01034b1:	e9 68 01 00 00       	jmp    c010361e <__alltraps>

c01034b6 <vector226>:
.globl vector226
vector226:
  pushl $0
c01034b6:	6a 00                	push   $0x0
  pushl $226
c01034b8:	68 e2 00 00 00       	push   $0xe2
  jmp __alltraps
c01034bd:	e9 5c 01 00 00       	jmp    c010361e <__alltraps>

c01034c2 <vector227>:
.globl vector227
vector227:
  pushl $0
c01034c2:	6a 00                	push   $0x0
  pushl $227
c01034c4:	68 e3 00 00 00       	push   $0xe3
  jmp __alltraps
c01034c9:	e9 50 01 00 00       	jmp    c010361e <__alltraps>

c01034ce <vector228>:
.globl vector228
vector228:
  pushl $0
c01034ce:	6a 00                	push   $0x0
  pushl $228
c01034d0:	68 e4 00 00 00       	push   $0xe4
  jmp __alltraps
c01034d5:	e9 44 01 00 00       	jmp    c010361e <__alltraps>

c01034da <vector229>:
.globl vector229
vector229:
  pushl $0
c01034da:	6a 00                	push   $0x0
  pushl $229
c01034dc:	68 e5 00 00 00       	push   $0xe5
  jmp __alltraps
c01034e1:	e9 38 01 00 00       	jmp    c010361e <__alltraps>

c01034e6 <vector230>:
.globl vector230
vector230:
  pushl $0
c01034e6:	6a 00                	push   $0x0
  pushl $230
c01034e8:	68 e6 00 00 00       	push   $0xe6
  jmp __alltraps
c01034ed:	e9 2c 01 00 00       	jmp    c010361e <__alltraps>

c01034f2 <vector231>:
.globl vector231
vector231:
  pushl $0
c01034f2:	6a 00                	push   $0x0
  pushl $231
c01034f4:	68 e7 00 00 00       	push   $0xe7
  jmp __alltraps
c01034f9:	e9 20 01 00 00       	jmp    c010361e <__alltraps>

c01034fe <vector232>:
.globl vector232
vector232:
  pushl $0
c01034fe:	6a 00                	push   $0x0
  pushl $232
c0103500:	68 e8 00 00 00       	push   $0xe8
  jmp __alltraps
c0103505:	e9 14 01 00 00       	jmp    c010361e <__alltraps>

c010350a <vector233>:
.globl vector233
vector233:
  pushl $0
c010350a:	6a 00                	push   $0x0
  pushl $233
c010350c:	68 e9 00 00 00       	push   $0xe9
  jmp __alltraps
c0103511:	e9 08 01 00 00       	jmp    c010361e <__alltraps>

c0103516 <vector234>:
.globl vector234
vector234:
  pushl $0
c0103516:	6a 00                	push   $0x0
  pushl $234
c0103518:	68 ea 00 00 00       	push   $0xea
  jmp __alltraps
c010351d:	e9 fc 00 00 00       	jmp    c010361e <__alltraps>

c0103522 <vector235>:
.globl vector235
vector235:
  pushl $0
c0103522:	6a 00                	push   $0x0
  pushl $235
c0103524:	68 eb 00 00 00       	push   $0xeb
  jmp __alltraps
c0103529:	e9 f0 00 00 00       	jmp    c010361e <__alltraps>

c010352e <vector236>:
.globl vector236
vector236:
  pushl $0
c010352e:	6a 00                	push   $0x0
  pushl $236
c0103530:	68 ec 00 00 00       	push   $0xec
  jmp __alltraps
c0103535:	e9 e4 00 00 00       	jmp    c010361e <__alltraps>

c010353a <vector237>:
.globl vector237
vector237:
  pushl $0
c010353a:	6a 00                	push   $0x0
  pushl $237
c010353c:	68 ed 00 00 00       	push   $0xed
  jmp __alltraps
c0103541:	e9 d8 00 00 00       	jmp    c010361e <__alltraps>

c0103546 <vector238>:
.globl vector238
vector238:
  pushl $0
c0103546:	6a 00                	push   $0x0
  pushl $238
c0103548:	68 ee 00 00 00       	push   $0xee
  jmp __alltraps
c010354d:	e9 cc 00 00 00       	jmp    c010361e <__alltraps>

c0103552 <vector239>:
.globl vector239
vector239:
  pushl $0
c0103552:	6a 00                	push   $0x0
  pushl $239
c0103554:	68 ef 00 00 00       	push   $0xef
  jmp __alltraps
c0103559:	e9 c0 00 00 00       	jmp    c010361e <__alltraps>

c010355e <vector240>:
.globl vector240
vector240:
  pushl $0
c010355e:	6a 00                	push   $0x0
  pushl $240
c0103560:	68 f0 00 00 00       	push   $0xf0
  jmp __alltraps
c0103565:	e9 b4 00 00 00       	jmp    c010361e <__alltraps>

c010356a <vector241>:
.globl vector241
vector241:
  pushl $0
c010356a:	6a 00                	push   $0x0
  pushl $241
c010356c:	68 f1 00 00 00       	push   $0xf1
  jmp __alltraps
c0103571:	e9 a8 00 00 00       	jmp    c010361e <__alltraps>

c0103576 <vector242>:
.globl vector242
vector242:
  pushl $0
c0103576:	6a 00                	push   $0x0
  pushl $242
c0103578:	68 f2 00 00 00       	push   $0xf2
  jmp __alltraps
c010357d:	e9 9c 00 00 00       	jmp    c010361e <__alltraps>

c0103582 <vector243>:
.globl vector243
vector243:
  pushl $0
c0103582:	6a 00                	push   $0x0
  pushl $243
c0103584:	68 f3 00 00 00       	push   $0xf3
  jmp __alltraps
c0103589:	e9 90 00 00 00       	jmp    c010361e <__alltraps>

c010358e <vector244>:
.globl vector244
vector244:
  pushl $0
c010358e:	6a 00                	push   $0x0
  pushl $244
c0103590:	68 f4 00 00 00       	push   $0xf4
  jmp __alltraps
c0103595:	e9 84 00 00 00       	jmp    c010361e <__alltraps>

c010359a <vector245>:
.globl vector245
vector245:
  pushl $0
c010359a:	6a 00                	push   $0x0
  pushl $245
c010359c:	68 f5 00 00 00       	push   $0xf5
  jmp __alltraps
c01035a1:	e9 78 00 00 00       	jmp    c010361e <__alltraps>

c01035a6 <vector246>:
.globl vector246
vector246:
  pushl $0
c01035a6:	6a 00                	push   $0x0
  pushl $246
c01035a8:	68 f6 00 00 00       	push   $0xf6
  jmp __alltraps
c01035ad:	e9 6c 00 00 00       	jmp    c010361e <__alltraps>

c01035b2 <vector247>:
.globl vector247
vector247:
  pushl $0
c01035b2:	6a 00                	push   $0x0
  pushl $247
c01035b4:	68 f7 00 00 00       	push   $0xf7
  jmp __alltraps
c01035b9:	e9 60 00 00 00       	jmp    c010361e <__alltraps>

c01035be <vector248>:
.globl vector248
vector248:
  pushl $0
c01035be:	6a 00                	push   $0x0
  pushl $248
c01035c0:	68 f8 00 00 00       	push   $0xf8
  jmp __alltraps
c01035c5:	e9 54 00 00 00       	jmp    c010361e <__alltraps>

c01035ca <vector249>:
.globl vector249
vector249:
  pushl $0
c01035ca:	6a 00                	push   $0x0
  pushl $249
c01035cc:	68 f9 00 00 00       	push   $0xf9
  jmp __alltraps
c01035d1:	e9 48 00 00 00       	jmp    c010361e <__alltraps>

c01035d6 <vector250>:
.globl vector250
vector250:
  pushl $0
c01035d6:	6a 00                	push   $0x0
  pushl $250
c01035d8:	68 fa 00 00 00       	push   $0xfa
  jmp __alltraps
c01035dd:	e9 3c 00 00 00       	jmp    c010361e <__alltraps>

c01035e2 <vector251>:
.globl vector251
vector251:
  pushl $0
c01035e2:	6a 00                	push   $0x0
  pushl $251
c01035e4:	68 fb 00 00 00       	push   $0xfb
  jmp __alltraps
c01035e9:	e9 30 00 00 00       	jmp    c010361e <__alltraps>

c01035ee <vector252>:
.globl vector252
vector252:
  pushl $0
c01035ee:	6a 00                	push   $0x0
  pushl $252
c01035f0:	68 fc 00 00 00       	push   $0xfc
  jmp __alltraps
c01035f5:	e9 24 00 00 00       	jmp    c010361e <__alltraps>

c01035fa <vector253>:
.globl vector253
vector253:
  pushl $0
c01035fa:	6a 00                	push   $0x0
  pushl $253
c01035fc:	68 fd 00 00 00       	push   $0xfd
  jmp __alltraps
c0103601:	e9 18 00 00 00       	jmp    c010361e <__alltraps>

c0103606 <vector254>:
.globl vector254
vector254:
  pushl $0
c0103606:	6a 00                	push   $0x0
  pushl $254
c0103608:	68 fe 00 00 00       	push   $0xfe
  jmp __alltraps
c010360d:	e9 0c 00 00 00       	jmp    c010361e <__alltraps>

c0103612 <vector255>:
.globl vector255
vector255:
  pushl $0
c0103612:	6a 00                	push   $0x0
  pushl $255
c0103614:	68 ff 00 00 00       	push   $0xff
  jmp __alltraps
c0103619:	e9 00 00 00 00       	jmp    c010361e <__alltraps>

c010361e <__alltraps>:
.text
.globl __alltraps
__alltraps:
    # push registers to build a trap frame
    # therefore make the stack look like a struct trapframe
    pushl %ds
c010361e:	1e                   	push   %ds
    pushl %es
c010361f:	06                   	push   %es
    pushl %fs
c0103620:	0f a0                	push   %fs
    pushl %gs
c0103622:	0f a8                	push   %gs
    pushal
c0103624:	60                   	pusha  

    # load GD_KDATA into %ds and %es to set up data segments for kernel
    movl $GD_KDATA, %eax
c0103625:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c010362a:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c010362c:	8e c0                	mov    %eax,%es

    # push %esp to pass a pointer to the trapframe as an argument to trap()
    pushl %esp
c010362e:	54                   	push   %esp

    # call trap(tf), where tf=%esp
    call trap
c010362f:	e8 e9 f4 ff ff       	call   c0102b1d <trap>

    # pop the pushed stack pointer
    popl %esp
c0103634:	5c                   	pop    %esp

c0103635 <__trapret>:

    # return falls through to trapret...
.globl __trapret
__trapret:
    # restore registers from stack
    popal
c0103635:	61                   	popa   

    # restore %ds, %es, %fs and %gs
    popl %gs
c0103636:	0f a9                	pop    %gs
    popl %fs
c0103638:	0f a1                	pop    %fs
    popl %es
c010363a:	07                   	pop    %es
    popl %ds
c010363b:	1f                   	pop    %ds

    # get rid of the trap number and error code
    addl $0x8, %esp
c010363c:	83 c4 08             	add    $0x8,%esp
    iret
c010363f:	cf                   	iret   

c0103640 <forkrets>:

.globl forkrets
forkrets:
    # set stack to this new process's trapframe
    movl 4(%esp), %esp
c0103640:	8b 64 24 04          	mov    0x4(%esp),%esp
    jmp __trapret
c0103644:	eb ef                	jmp    c0103635 <__trapret>

c0103646 <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c0103646:	55                   	push   %ebp
c0103647:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0103649:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c010364e:	8b 55 08             	mov    0x8(%ebp),%edx
c0103651:	29 c2                	sub    %eax,%edx
c0103653:	89 d0                	mov    %edx,%eax
c0103655:	c1 f8 05             	sar    $0x5,%eax
}
c0103658:	5d                   	pop    %ebp
c0103659:	c3                   	ret    

c010365a <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c010365a:	55                   	push   %ebp
c010365b:	89 e5                	mov    %esp,%ebp
c010365d:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0103660:	8b 45 08             	mov    0x8(%ebp),%eax
c0103663:	89 04 24             	mov    %eax,(%esp)
c0103666:	e8 db ff ff ff       	call   c0103646 <page2ppn>
c010366b:	c1 e0 0c             	shl    $0xc,%eax
}
c010366e:	c9                   	leave  
c010366f:	c3                   	ret    

c0103670 <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c0103670:	55                   	push   %ebp
c0103671:	89 e5                	mov    %esp,%ebp
c0103673:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0103676:	8b 45 08             	mov    0x8(%ebp),%eax
c0103679:	c1 e8 0c             	shr    $0xc,%eax
c010367c:	89 c2                	mov    %eax,%edx
c010367e:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0103683:	39 c2                	cmp    %eax,%edx
c0103685:	72 1c                	jb     c01036a3 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0103687:	c7 44 24 08 50 cb 10 	movl   $0xc010cb50,0x8(%esp)
c010368e:	c0 
c010368f:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
c0103696:	00 
c0103697:	c7 04 24 6f cb 10 c0 	movl   $0xc010cb6f,(%esp)
c010369e:	e8 9a cd ff ff       	call   c010043d <__panic>
    }
    return &pages[PPN(pa)];
c01036a3:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c01036a8:	8b 55 08             	mov    0x8(%ebp),%edx
c01036ab:	c1 ea 0c             	shr    $0xc,%edx
c01036ae:	c1 e2 05             	shl    $0x5,%edx
c01036b1:	01 d0                	add    %edx,%eax
}
c01036b3:	c9                   	leave  
c01036b4:	c3                   	ret    

c01036b5 <page2kva>:

static inline void *
page2kva(struct Page *page) {
c01036b5:	55                   	push   %ebp
c01036b6:	89 e5                	mov    %esp,%ebp
c01036b8:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01036bb:	8b 45 08             	mov    0x8(%ebp),%eax
c01036be:	89 04 24             	mov    %eax,(%esp)
c01036c1:	e8 94 ff ff ff       	call   c010365a <page2pa>
c01036c6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01036c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01036cc:	c1 e8 0c             	shr    $0xc,%eax
c01036cf:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01036d2:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c01036d7:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01036da:	72 23                	jb     c01036ff <page2kva+0x4a>
c01036dc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01036df:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01036e3:	c7 44 24 08 80 cb 10 	movl   $0xc010cb80,0x8(%esp)
c01036ea:	c0 
c01036eb:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c01036f2:	00 
c01036f3:	c7 04 24 6f cb 10 c0 	movl   $0xc010cb6f,(%esp)
c01036fa:	e8 3e cd ff ff       	call   c010043d <__panic>
c01036ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103702:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0103707:	c9                   	leave  
c0103708:	c3                   	ret    

c0103709 <pte2page>:
kva2page(void *kva) {
    return pa2page(PADDR(kva));
}

static inline struct Page *
pte2page(pte_t pte) {
c0103709:	55                   	push   %ebp
c010370a:	89 e5                	mov    %esp,%ebp
c010370c:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c010370f:	8b 45 08             	mov    0x8(%ebp),%eax
c0103712:	83 e0 01             	and    $0x1,%eax
c0103715:	85 c0                	test   %eax,%eax
c0103717:	75 1c                	jne    c0103735 <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0103719:	c7 44 24 08 a4 cb 10 	movl   $0xc010cba4,0x8(%esp)
c0103720:	c0 
c0103721:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c0103728:	00 
c0103729:	c7 04 24 6f cb 10 c0 	movl   $0xc010cb6f,(%esp)
c0103730:	e8 08 cd ff ff       	call   c010043d <__panic>
    }
    return pa2page(PTE_ADDR(pte));
c0103735:	8b 45 08             	mov    0x8(%ebp),%eax
c0103738:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010373d:	89 04 24             	mov    %eax,(%esp)
c0103740:	e8 2b ff ff ff       	call   c0103670 <pa2page>
}
c0103745:	c9                   	leave  
c0103746:	c3                   	ret    

c0103747 <pde2page>:

static inline struct Page *
pde2page(pde_t pde) {
c0103747:	55                   	push   %ebp
c0103748:	89 e5                	mov    %esp,%ebp
c010374a:	83 ec 18             	sub    $0x18,%esp
    return pa2page(PDE_ADDR(pde));
c010374d:	8b 45 08             	mov    0x8(%ebp),%eax
c0103750:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103755:	89 04 24             	mov    %eax,(%esp)
c0103758:	e8 13 ff ff ff       	call   c0103670 <pa2page>
}
c010375d:	c9                   	leave  
c010375e:	c3                   	ret    

c010375f <page_ref>:

static inline int
page_ref(struct Page *page) {
c010375f:	55                   	push   %ebp
c0103760:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0103762:	8b 45 08             	mov    0x8(%ebp),%eax
c0103765:	8b 00                	mov    (%eax),%eax
}
c0103767:	5d                   	pop    %ebp
c0103768:	c3                   	ret    

c0103769 <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c0103769:	55                   	push   %ebp
c010376a:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c010376c:	8b 45 08             	mov    0x8(%ebp),%eax
c010376f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0103772:	89 10                	mov    %edx,(%eax)
}
c0103774:	90                   	nop
c0103775:	5d                   	pop    %ebp
c0103776:	c3                   	ret    

c0103777 <page_ref_inc>:

static inline int
page_ref_inc(struct Page *page) {
c0103777:	55                   	push   %ebp
c0103778:	89 e5                	mov    %esp,%ebp
    page->ref += 1;
c010377a:	8b 45 08             	mov    0x8(%ebp),%eax
c010377d:	8b 00                	mov    (%eax),%eax
c010377f:	8d 50 01             	lea    0x1(%eax),%edx
c0103782:	8b 45 08             	mov    0x8(%ebp),%eax
c0103785:	89 10                	mov    %edx,(%eax)
    return page->ref;
c0103787:	8b 45 08             	mov    0x8(%ebp),%eax
c010378a:	8b 00                	mov    (%eax),%eax
}
c010378c:	5d                   	pop    %ebp
c010378d:	c3                   	ret    

c010378e <page_ref_dec>:

static inline int
page_ref_dec(struct Page *page) {
c010378e:	55                   	push   %ebp
c010378f:	89 e5                	mov    %esp,%ebp
    page->ref -= 1;
c0103791:	8b 45 08             	mov    0x8(%ebp),%eax
c0103794:	8b 00                	mov    (%eax),%eax
c0103796:	8d 50 ff             	lea    -0x1(%eax),%edx
c0103799:	8b 45 08             	mov    0x8(%ebp),%eax
c010379c:	89 10                	mov    %edx,(%eax)
    return page->ref;
c010379e:	8b 45 08             	mov    0x8(%ebp),%eax
c01037a1:	8b 00                	mov    (%eax),%eax
}
c01037a3:	5d                   	pop    %ebp
c01037a4:	c3                   	ret    

c01037a5 <__intr_save>:
__intr_save(void) {
c01037a5:	55                   	push   %ebp
c01037a6:	89 e5                	mov    %esp,%ebp
c01037a8:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01037ab:	9c                   	pushf  
c01037ac:	58                   	pop    %eax
c01037ad:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01037b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01037b3:	25 00 02 00 00       	and    $0x200,%eax
c01037b8:	85 c0                	test   %eax,%eax
c01037ba:	74 0c                	je     c01037c8 <__intr_save+0x23>
        intr_disable();
c01037bc:	e8 37 eb ff ff       	call   c01022f8 <intr_disable>
        return 1;
c01037c1:	b8 01 00 00 00       	mov    $0x1,%eax
c01037c6:	eb 05                	jmp    c01037cd <__intr_save+0x28>
    return 0;
c01037c8:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01037cd:	c9                   	leave  
c01037ce:	c3                   	ret    

c01037cf <__intr_restore>:
__intr_restore(bool flag) {
c01037cf:	55                   	push   %ebp
c01037d0:	89 e5                	mov    %esp,%ebp
c01037d2:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c01037d5:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01037d9:	74 05                	je     c01037e0 <__intr_restore+0x11>
        intr_enable();
c01037db:	e8 0c eb ff ff       	call   c01022ec <intr_enable>
}
c01037e0:	90                   	nop
c01037e1:	c9                   	leave  
c01037e2:	c3                   	ret    

c01037e3 <lgdt>:
/* *
 * lgdt - load the global descriptor table register and reset the
 * data/code segement registers for kernel.
 * */
static inline void
lgdt(struct pseudodesc *pd) {
c01037e3:	55                   	push   %ebp
c01037e4:	89 e5                	mov    %esp,%ebp
    asm volatile ("lgdt (%0)" :: "r" (pd));
c01037e6:	8b 45 08             	mov    0x8(%ebp),%eax
c01037e9:	0f 01 10             	lgdtl  (%eax)
    asm volatile ("movw %%ax, %%gs" :: "a" (USER_DS));
c01037ec:	b8 23 00 00 00       	mov    $0x23,%eax
c01037f1:	8e e8                	mov    %eax,%gs
    asm volatile ("movw %%ax, %%fs" :: "a" (USER_DS));
c01037f3:	b8 23 00 00 00       	mov    $0x23,%eax
c01037f8:	8e e0                	mov    %eax,%fs
    asm volatile ("movw %%ax, %%es" :: "a" (KERNEL_DS));
c01037fa:	b8 10 00 00 00       	mov    $0x10,%eax
c01037ff:	8e c0                	mov    %eax,%es
    asm volatile ("movw %%ax, %%ds" :: "a" (KERNEL_DS));
c0103801:	b8 10 00 00 00       	mov    $0x10,%eax
c0103806:	8e d8                	mov    %eax,%ds
    asm volatile ("movw %%ax, %%ss" :: "a" (KERNEL_DS));
c0103808:	b8 10 00 00 00       	mov    $0x10,%eax
c010380d:	8e d0                	mov    %eax,%ss
    // reload cs
    asm volatile ("ljmp %0, $1f\n 1:\n" :: "i" (KERNEL_CS));
c010380f:	ea 16 38 10 c0 08 00 	ljmp   $0x8,$0xc0103816
}
c0103816:	90                   	nop
c0103817:	5d                   	pop    %ebp
c0103818:	c3                   	ret    

c0103819 <load_esp0>:
 * load_esp0 - change the ESP0 in default task state segment,
 * so that we can use different kernel stack when we trap frame
 * user to kernel.
 * */
void
load_esp0(uintptr_t esp0) {
c0103819:	f3 0f 1e fb          	endbr32 
c010381d:	55                   	push   %ebp
c010381e:	89 e5                	mov    %esp,%ebp
    ts.ts_esp0 = esp0;
c0103820:	8b 45 08             	mov    0x8(%ebp),%eax
c0103823:	a3 a4 1f 1b c0       	mov    %eax,0xc01b1fa4
}
c0103828:	90                   	nop
c0103829:	5d                   	pop    %ebp
c010382a:	c3                   	ret    

c010382b <gdt_init>:

/* gdt_init - initialize the default GDT and TSS */
static void
gdt_init(void) {
c010382b:	f3 0f 1e fb          	endbr32 
c010382f:	55                   	push   %ebp
c0103830:	89 e5                	mov    %esp,%ebp
c0103832:	83 ec 14             	sub    $0x14,%esp
    // set boot kernel stack and default SS0
    load_esp0((uintptr_t)bootstacktop);
c0103835:	b8 00 e0 12 c0       	mov    $0xc012e000,%eax
c010383a:	89 04 24             	mov    %eax,(%esp)
c010383d:	e8 d7 ff ff ff       	call   c0103819 <load_esp0>
    ts.ts_ss0 = KERNEL_DS;
c0103842:	66 c7 05 a8 1f 1b c0 	movw   $0x10,0xc01b1fa8
c0103849:	10 00 

    // initialize the TSS filed of the gdt
    gdt[SEG_TSS] = SEGTSS(STS_T32A, (uintptr_t)&ts, sizeof(ts), DPL_KERNEL);
c010384b:	66 c7 05 28 ea 12 c0 	movw   $0x68,0xc012ea28
c0103852:	68 00 
c0103854:	b8 a0 1f 1b c0       	mov    $0xc01b1fa0,%eax
c0103859:	0f b7 c0             	movzwl %ax,%eax
c010385c:	66 a3 2a ea 12 c0    	mov    %ax,0xc012ea2a
c0103862:	b8 a0 1f 1b c0       	mov    $0xc01b1fa0,%eax
c0103867:	c1 e8 10             	shr    $0x10,%eax
c010386a:	a2 2c ea 12 c0       	mov    %al,0xc012ea2c
c010386f:	0f b6 05 2d ea 12 c0 	movzbl 0xc012ea2d,%eax
c0103876:	24 f0                	and    $0xf0,%al
c0103878:	0c 09                	or     $0x9,%al
c010387a:	a2 2d ea 12 c0       	mov    %al,0xc012ea2d
c010387f:	0f b6 05 2d ea 12 c0 	movzbl 0xc012ea2d,%eax
c0103886:	24 ef                	and    $0xef,%al
c0103888:	a2 2d ea 12 c0       	mov    %al,0xc012ea2d
c010388d:	0f b6 05 2d ea 12 c0 	movzbl 0xc012ea2d,%eax
c0103894:	24 9f                	and    $0x9f,%al
c0103896:	a2 2d ea 12 c0       	mov    %al,0xc012ea2d
c010389b:	0f b6 05 2d ea 12 c0 	movzbl 0xc012ea2d,%eax
c01038a2:	0c 80                	or     $0x80,%al
c01038a4:	a2 2d ea 12 c0       	mov    %al,0xc012ea2d
c01038a9:	0f b6 05 2e ea 12 c0 	movzbl 0xc012ea2e,%eax
c01038b0:	24 f0                	and    $0xf0,%al
c01038b2:	a2 2e ea 12 c0       	mov    %al,0xc012ea2e
c01038b7:	0f b6 05 2e ea 12 c0 	movzbl 0xc012ea2e,%eax
c01038be:	24 ef                	and    $0xef,%al
c01038c0:	a2 2e ea 12 c0       	mov    %al,0xc012ea2e
c01038c5:	0f b6 05 2e ea 12 c0 	movzbl 0xc012ea2e,%eax
c01038cc:	24 df                	and    $0xdf,%al
c01038ce:	a2 2e ea 12 c0       	mov    %al,0xc012ea2e
c01038d3:	0f b6 05 2e ea 12 c0 	movzbl 0xc012ea2e,%eax
c01038da:	0c 40                	or     $0x40,%al
c01038dc:	a2 2e ea 12 c0       	mov    %al,0xc012ea2e
c01038e1:	0f b6 05 2e ea 12 c0 	movzbl 0xc012ea2e,%eax
c01038e8:	24 7f                	and    $0x7f,%al
c01038ea:	a2 2e ea 12 c0       	mov    %al,0xc012ea2e
c01038ef:	b8 a0 1f 1b c0       	mov    $0xc01b1fa0,%eax
c01038f4:	c1 e8 18             	shr    $0x18,%eax
c01038f7:	a2 2f ea 12 c0       	mov    %al,0xc012ea2f

    // reload all segment registers
    lgdt(&gdt_pd);
c01038fc:	c7 04 24 30 ea 12 c0 	movl   $0xc012ea30,(%esp)
c0103903:	e8 db fe ff ff       	call   c01037e3 <lgdt>
c0103908:	66 c7 45 fe 28 00    	movw   $0x28,-0x2(%ebp)
    asm volatile ("ltr %0" :: "r" (sel) : "memory");
c010390e:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0103912:	0f 00 d8             	ltr    %ax
}
c0103915:	90                   	nop

    // load the TSS
    ltr(GD_TSS);
}
c0103916:	90                   	nop
c0103917:	c9                   	leave  
c0103918:	c3                   	ret    

c0103919 <init_pmm_manager>:

//init_pmm_manager - initialize a pmm_manager instance
static void
init_pmm_manager(void) {
c0103919:	f3 0f 1e fb          	endbr32 
c010391d:	55                   	push   %ebp
c010391e:	89 e5                	mov    %esp,%ebp
c0103920:	83 ec 18             	sub    $0x18,%esp
    pmm_manager = &default_pmm_manager;
c0103923:	c7 05 58 40 1b c0 08 	movl   $0xc010e108,0xc01b4058
c010392a:	e1 10 c0 
    cprintf("memory management: %s\n", pmm_manager->name);
c010392d:	a1 58 40 1b c0       	mov    0xc01b4058,%eax
c0103932:	8b 00                	mov    (%eax),%eax
c0103934:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103938:	c7 04 24 d0 cb 10 c0 	movl   $0xc010cbd0,(%esp)
c010393f:	e8 8d c9 ff ff       	call   c01002d1 <cprintf>
    pmm_manager->init();
c0103944:	a1 58 40 1b c0       	mov    0xc01b4058,%eax
c0103949:	8b 40 04             	mov    0x4(%eax),%eax
c010394c:	ff d0                	call   *%eax
}
c010394e:	90                   	nop
c010394f:	c9                   	leave  
c0103950:	c3                   	ret    

c0103951 <init_memmap>:

//init_memmap - call pmm->init_memmap to build Page struct for free memory  
static void
init_memmap(struct Page *base, size_t n) {
c0103951:	f3 0f 1e fb          	endbr32 
c0103955:	55                   	push   %ebp
c0103956:	89 e5                	mov    %esp,%ebp
c0103958:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->init_memmap(base, n);
c010395b:	a1 58 40 1b c0       	mov    0xc01b4058,%eax
c0103960:	8b 40 08             	mov    0x8(%eax),%eax
c0103963:	8b 55 0c             	mov    0xc(%ebp),%edx
c0103966:	89 54 24 04          	mov    %edx,0x4(%esp)
c010396a:	8b 55 08             	mov    0x8(%ebp),%edx
c010396d:	89 14 24             	mov    %edx,(%esp)
c0103970:	ff d0                	call   *%eax
}
c0103972:	90                   	nop
c0103973:	c9                   	leave  
c0103974:	c3                   	ret    

c0103975 <alloc_pages>:

//alloc_pages - call pmm->alloc_pages to allocate a continuous n*PAGESIZE memory 
struct Page *
alloc_pages(size_t n) {
c0103975:	f3 0f 1e fb          	endbr32 
c0103979:	55                   	push   %ebp
c010397a:	89 e5                	mov    %esp,%ebp
c010397c:	83 ec 28             	sub    $0x28,%esp
    struct Page *page=NULL;
c010397f:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    
    while (1)
    {
         local_intr_save(intr_flag);
c0103986:	e8 1a fe ff ff       	call   c01037a5 <__intr_save>
c010398b:	89 45 f0             	mov    %eax,-0x10(%ebp)
         {
              page = pmm_manager->alloc_pages(n);
c010398e:	a1 58 40 1b c0       	mov    0xc01b4058,%eax
c0103993:	8b 40 0c             	mov    0xc(%eax),%eax
c0103996:	8b 55 08             	mov    0x8(%ebp),%edx
c0103999:	89 14 24             	mov    %edx,(%esp)
c010399c:	ff d0                	call   *%eax
c010399e:	89 45 f4             	mov    %eax,-0xc(%ebp)
         }
         local_intr_restore(intr_flag);
c01039a1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01039a4:	89 04 24             	mov    %eax,(%esp)
c01039a7:	e8 23 fe ff ff       	call   c01037cf <__intr_restore>

         if (page != NULL || n > 1 || swap_init_ok == 0) break;
c01039ac:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01039b0:	75 2d                	jne    c01039df <alloc_pages+0x6a>
c01039b2:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
c01039b6:	77 27                	ja     c01039df <alloc_pages+0x6a>
c01039b8:	a1 14 20 1b c0       	mov    0xc01b2014,%eax
c01039bd:	85 c0                	test   %eax,%eax
c01039bf:	74 1e                	je     c01039df <alloc_pages+0x6a>
         
         extern struct mm_struct *check_mm_struct;
         //cprintf("page %x, call swap_out in alloc_pages %d\n",page, n);
         swap_out(check_mm_struct, n, 0);
c01039c1:	8b 55 08             	mov    0x8(%ebp),%edx
c01039c4:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c01039c9:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01039d0:	00 
c01039d1:	89 54 24 04          	mov    %edx,0x4(%esp)
c01039d5:	89 04 24             	mov    %eax,(%esp)
c01039d8:	e8 4b 3c 00 00       	call   c0107628 <swap_out>
    {
c01039dd:	eb a7                	jmp    c0103986 <alloc_pages+0x11>
    }
    //cprintf("n %d,get page %x, No %d in alloc_pages\n",n,page,(page-pages));
    return page;
c01039df:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01039e2:	c9                   	leave  
c01039e3:	c3                   	ret    

c01039e4 <free_pages>:

//free_pages - call pmm->free_pages to free a continuous n*PAGESIZE memory 
void
free_pages(struct Page *base, size_t n) {
c01039e4:	f3 0f 1e fb          	endbr32 
c01039e8:	55                   	push   %ebp
c01039e9:	89 e5                	mov    %esp,%ebp
c01039eb:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c01039ee:	e8 b2 fd ff ff       	call   c01037a5 <__intr_save>
c01039f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        pmm_manager->free_pages(base, n);
c01039f6:	a1 58 40 1b c0       	mov    0xc01b4058,%eax
c01039fb:	8b 40 10             	mov    0x10(%eax),%eax
c01039fe:	8b 55 0c             	mov    0xc(%ebp),%edx
c0103a01:	89 54 24 04          	mov    %edx,0x4(%esp)
c0103a05:	8b 55 08             	mov    0x8(%ebp),%edx
c0103a08:	89 14 24             	mov    %edx,(%esp)
c0103a0b:	ff d0                	call   *%eax
    }
    local_intr_restore(intr_flag);
c0103a0d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103a10:	89 04 24             	mov    %eax,(%esp)
c0103a13:	e8 b7 fd ff ff       	call   c01037cf <__intr_restore>
}
c0103a18:	90                   	nop
c0103a19:	c9                   	leave  
c0103a1a:	c3                   	ret    

c0103a1b <nr_free_pages>:

//nr_free_pages - call pmm->nr_free_pages to get the size (nr*PAGESIZE) 
//of current free memory
size_t
nr_free_pages(void) {
c0103a1b:	f3 0f 1e fb          	endbr32 
c0103a1f:	55                   	push   %ebp
c0103a20:	89 e5                	mov    %esp,%ebp
c0103a22:	83 ec 28             	sub    $0x28,%esp
    size_t ret;
    bool intr_flag;
    local_intr_save(intr_flag);
c0103a25:	e8 7b fd ff ff       	call   c01037a5 <__intr_save>
c0103a2a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        ret = pmm_manager->nr_free_pages();
c0103a2d:	a1 58 40 1b c0       	mov    0xc01b4058,%eax
c0103a32:	8b 40 14             	mov    0x14(%eax),%eax
c0103a35:	ff d0                	call   *%eax
c0103a37:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    local_intr_restore(intr_flag);
c0103a3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103a3d:	89 04 24             	mov    %eax,(%esp)
c0103a40:	e8 8a fd ff ff       	call   c01037cf <__intr_restore>
    return ret;
c0103a45:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0103a48:	c9                   	leave  
c0103a49:	c3                   	ret    

c0103a4a <page_init>:

/* pmm_init - initialize the physical memory management */
static void
page_init(void) {
c0103a4a:	f3 0f 1e fb          	endbr32 
c0103a4e:	55                   	push   %ebp
c0103a4f:	89 e5                	mov    %esp,%ebp
c0103a51:	57                   	push   %edi
c0103a52:	56                   	push   %esi
c0103a53:	53                   	push   %ebx
c0103a54:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
c0103a5a:	c7 45 c4 00 80 00 c0 	movl   $0xc0008000,-0x3c(%ebp)
    uint64_t maxpa = 0;
c0103a61:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0103a68:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)

    cprintf("e820map:\n");
c0103a6f:	c7 04 24 e7 cb 10 c0 	movl   $0xc010cbe7,(%esp)
c0103a76:	e8 56 c8 ff ff       	call   c01002d1 <cprintf>
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c0103a7b:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0103a82:	e9 1a 01 00 00       	jmp    c0103ba1 <page_init+0x157>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0103a87:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103a8a:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103a8d:	89 d0                	mov    %edx,%eax
c0103a8f:	c1 e0 02             	shl    $0x2,%eax
c0103a92:	01 d0                	add    %edx,%eax
c0103a94:	c1 e0 02             	shl    $0x2,%eax
c0103a97:	01 c8                	add    %ecx,%eax
c0103a99:	8b 50 08             	mov    0x8(%eax),%edx
c0103a9c:	8b 40 04             	mov    0x4(%eax),%eax
c0103a9f:	89 45 a0             	mov    %eax,-0x60(%ebp)
c0103aa2:	89 55 a4             	mov    %edx,-0x5c(%ebp)
c0103aa5:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103aa8:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103aab:	89 d0                	mov    %edx,%eax
c0103aad:	c1 e0 02             	shl    $0x2,%eax
c0103ab0:	01 d0                	add    %edx,%eax
c0103ab2:	c1 e0 02             	shl    $0x2,%eax
c0103ab5:	01 c8                	add    %ecx,%eax
c0103ab7:	8b 48 0c             	mov    0xc(%eax),%ecx
c0103aba:	8b 58 10             	mov    0x10(%eax),%ebx
c0103abd:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0103ac0:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0103ac3:	01 c8                	add    %ecx,%eax
c0103ac5:	11 da                	adc    %ebx,%edx
c0103ac7:	89 45 98             	mov    %eax,-0x68(%ebp)
c0103aca:	89 55 9c             	mov    %edx,-0x64(%ebp)
        cprintf("  memory: %08llx, [%08llx, %08llx], type = %d.\n",
c0103acd:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103ad0:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103ad3:	89 d0                	mov    %edx,%eax
c0103ad5:	c1 e0 02             	shl    $0x2,%eax
c0103ad8:	01 d0                	add    %edx,%eax
c0103ada:	c1 e0 02             	shl    $0x2,%eax
c0103add:	01 c8                	add    %ecx,%eax
c0103adf:	83 c0 14             	add    $0x14,%eax
c0103ae2:	8b 00                	mov    (%eax),%eax
c0103ae4:	89 45 84             	mov    %eax,-0x7c(%ebp)
c0103ae7:	8b 45 98             	mov    -0x68(%ebp),%eax
c0103aea:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0103aed:	83 c0 ff             	add    $0xffffffff,%eax
c0103af0:	83 d2 ff             	adc    $0xffffffff,%edx
c0103af3:	89 85 78 ff ff ff    	mov    %eax,-0x88(%ebp)
c0103af9:	89 95 7c ff ff ff    	mov    %edx,-0x84(%ebp)
c0103aff:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103b02:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103b05:	89 d0                	mov    %edx,%eax
c0103b07:	c1 e0 02             	shl    $0x2,%eax
c0103b0a:	01 d0                	add    %edx,%eax
c0103b0c:	c1 e0 02             	shl    $0x2,%eax
c0103b0f:	01 c8                	add    %ecx,%eax
c0103b11:	8b 48 0c             	mov    0xc(%eax),%ecx
c0103b14:	8b 58 10             	mov    0x10(%eax),%ebx
c0103b17:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0103b1a:	89 54 24 1c          	mov    %edx,0x1c(%esp)
c0103b1e:	8b 85 78 ff ff ff    	mov    -0x88(%ebp),%eax
c0103b24:	8b 95 7c ff ff ff    	mov    -0x84(%ebp),%edx
c0103b2a:	89 44 24 14          	mov    %eax,0x14(%esp)
c0103b2e:	89 54 24 18          	mov    %edx,0x18(%esp)
c0103b32:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0103b35:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0103b38:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103b3c:	89 54 24 10          	mov    %edx,0x10(%esp)
c0103b40:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0103b44:	89 5c 24 08          	mov    %ebx,0x8(%esp)
c0103b48:	c7 04 24 f4 cb 10 c0 	movl   $0xc010cbf4,(%esp)
c0103b4f:	e8 7d c7 ff ff       	call   c01002d1 <cprintf>
                memmap->map[i].size, begin, end - 1, memmap->map[i].type);
        if (memmap->map[i].type == E820_ARM) {
c0103b54:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103b57:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103b5a:	89 d0                	mov    %edx,%eax
c0103b5c:	c1 e0 02             	shl    $0x2,%eax
c0103b5f:	01 d0                	add    %edx,%eax
c0103b61:	c1 e0 02             	shl    $0x2,%eax
c0103b64:	01 c8                	add    %ecx,%eax
c0103b66:	83 c0 14             	add    $0x14,%eax
c0103b69:	8b 00                	mov    (%eax),%eax
c0103b6b:	83 f8 01             	cmp    $0x1,%eax
c0103b6e:	75 2e                	jne    c0103b9e <page_init+0x154>
            if (maxpa < end && begin < KMEMSIZE) {
c0103b70:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103b73:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0103b76:	3b 45 98             	cmp    -0x68(%ebp),%eax
c0103b79:	89 d0                	mov    %edx,%eax
c0103b7b:	1b 45 9c             	sbb    -0x64(%ebp),%eax
c0103b7e:	73 1e                	jae    c0103b9e <page_init+0x154>
c0103b80:	ba ff ff ff 37       	mov    $0x37ffffff,%edx
c0103b85:	b8 00 00 00 00       	mov    $0x0,%eax
c0103b8a:	3b 55 a0             	cmp    -0x60(%ebp),%edx
c0103b8d:	1b 45 a4             	sbb    -0x5c(%ebp),%eax
c0103b90:	72 0c                	jb     c0103b9e <page_init+0x154>
                maxpa = end;
c0103b92:	8b 45 98             	mov    -0x68(%ebp),%eax
c0103b95:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0103b98:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0103b9b:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    for (i = 0; i < memmap->nr_map; i ++) {
c0103b9e:	ff 45 dc             	incl   -0x24(%ebp)
c0103ba1:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0103ba4:	8b 00                	mov    (%eax),%eax
c0103ba6:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0103ba9:	0f 8c d8 fe ff ff    	jl     c0103a87 <page_init+0x3d>
            }
        }
    }
    if (maxpa > KMEMSIZE) {
c0103baf:	ba 00 00 00 38       	mov    $0x38000000,%edx
c0103bb4:	b8 00 00 00 00       	mov    $0x0,%eax
c0103bb9:	3b 55 e0             	cmp    -0x20(%ebp),%edx
c0103bbc:	1b 45 e4             	sbb    -0x1c(%ebp),%eax
c0103bbf:	73 0e                	jae    c0103bcf <page_init+0x185>
        maxpa = KMEMSIZE;
c0103bc1:	c7 45 e0 00 00 00 38 	movl   $0x38000000,-0x20(%ebp)
c0103bc8:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    }

    extern char end[];

    npage = maxpa / PGSIZE;
c0103bcf:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103bd2:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0103bd5:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0103bd9:	c1 ea 0c             	shr    $0xc,%edx
c0103bdc:	a3 80 1f 1b c0       	mov    %eax,0xc01b1f80
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
c0103be1:	c7 45 c0 00 10 00 00 	movl   $0x1000,-0x40(%ebp)
c0103be8:	b8 58 41 1b c0       	mov    $0xc01b4158,%eax
c0103bed:	8d 50 ff             	lea    -0x1(%eax),%edx
c0103bf0:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0103bf3:	01 d0                	add    %edx,%eax
c0103bf5:	89 45 bc             	mov    %eax,-0x44(%ebp)
c0103bf8:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0103bfb:	ba 00 00 00 00       	mov    $0x0,%edx
c0103c00:	f7 75 c0             	divl   -0x40(%ebp)
c0103c03:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0103c06:	29 d0                	sub    %edx,%eax
c0103c08:	a3 60 40 1b c0       	mov    %eax,0xc01b4060

    for (i = 0; i < npage; i ++) {
c0103c0d:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0103c14:	eb 27                	jmp    c0103c3d <page_init+0x1f3>
        SetPageReserved(pages + i);
c0103c16:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c0103c1b:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103c1e:	c1 e2 05             	shl    $0x5,%edx
c0103c21:	01 d0                	add    %edx,%eax
c0103c23:	83 c0 04             	add    $0x4,%eax
c0103c26:	c7 45 94 00 00 00 00 	movl   $0x0,-0x6c(%ebp)
c0103c2d:	89 45 90             	mov    %eax,-0x70(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0103c30:	8b 45 90             	mov    -0x70(%ebp),%eax
c0103c33:	8b 55 94             	mov    -0x6c(%ebp),%edx
c0103c36:	0f ab 10             	bts    %edx,(%eax)
}
c0103c39:	90                   	nop
    for (i = 0; i < npage; i ++) {
c0103c3a:	ff 45 dc             	incl   -0x24(%ebp)
c0103c3d:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103c40:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0103c45:	39 c2                	cmp    %eax,%edx
c0103c47:	72 cd                	jb     c0103c16 <page_init+0x1cc>
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);
c0103c49:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0103c4e:	c1 e0 05             	shl    $0x5,%eax
c0103c51:	89 c2                	mov    %eax,%edx
c0103c53:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c0103c58:	01 d0                	add    %edx,%eax
c0103c5a:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0103c5d:	81 7d b8 ff ff ff bf 	cmpl   $0xbfffffff,-0x48(%ebp)
c0103c64:	77 23                	ja     c0103c89 <page_init+0x23f>
c0103c66:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0103c69:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103c6d:	c7 44 24 08 24 cc 10 	movl   $0xc010cc24,0x8(%esp)
c0103c74:	c0 
c0103c75:	c7 44 24 04 ea 00 00 	movl   $0xea,0x4(%esp)
c0103c7c:	00 
c0103c7d:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0103c84:	e8 b4 c7 ff ff       	call   c010043d <__panic>
c0103c89:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0103c8c:	05 00 00 00 40       	add    $0x40000000,%eax
c0103c91:	89 45 b4             	mov    %eax,-0x4c(%ebp)

    for (i = 0; i < memmap->nr_map; i ++) {
c0103c94:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0103c9b:	e9 4b 01 00 00       	jmp    c0103deb <page_init+0x3a1>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0103ca0:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103ca3:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103ca6:	89 d0                	mov    %edx,%eax
c0103ca8:	c1 e0 02             	shl    $0x2,%eax
c0103cab:	01 d0                	add    %edx,%eax
c0103cad:	c1 e0 02             	shl    $0x2,%eax
c0103cb0:	01 c8                	add    %ecx,%eax
c0103cb2:	8b 50 08             	mov    0x8(%eax),%edx
c0103cb5:	8b 40 04             	mov    0x4(%eax),%eax
c0103cb8:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0103cbb:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0103cbe:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103cc1:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103cc4:	89 d0                	mov    %edx,%eax
c0103cc6:	c1 e0 02             	shl    $0x2,%eax
c0103cc9:	01 d0                	add    %edx,%eax
c0103ccb:	c1 e0 02             	shl    $0x2,%eax
c0103cce:	01 c8                	add    %ecx,%eax
c0103cd0:	8b 48 0c             	mov    0xc(%eax),%ecx
c0103cd3:	8b 58 10             	mov    0x10(%eax),%ebx
c0103cd6:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103cd9:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103cdc:	01 c8                	add    %ecx,%eax
c0103cde:	11 da                	adc    %ebx,%edx
c0103ce0:	89 45 c8             	mov    %eax,-0x38(%ebp)
c0103ce3:	89 55 cc             	mov    %edx,-0x34(%ebp)
        if (memmap->map[i].type == E820_ARM) {
c0103ce6:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0103ce9:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0103cec:	89 d0                	mov    %edx,%eax
c0103cee:	c1 e0 02             	shl    $0x2,%eax
c0103cf1:	01 d0                	add    %edx,%eax
c0103cf3:	c1 e0 02             	shl    $0x2,%eax
c0103cf6:	01 c8                	add    %ecx,%eax
c0103cf8:	83 c0 14             	add    $0x14,%eax
c0103cfb:	8b 00                	mov    (%eax),%eax
c0103cfd:	83 f8 01             	cmp    $0x1,%eax
c0103d00:	0f 85 e2 00 00 00    	jne    c0103de8 <page_init+0x39e>
            if (begin < freemem) {
c0103d06:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103d09:	ba 00 00 00 00       	mov    $0x0,%edx
c0103d0e:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c0103d11:	39 45 d0             	cmp    %eax,-0x30(%ebp)
c0103d14:	19 d1                	sbb    %edx,%ecx
c0103d16:	73 0d                	jae    c0103d25 <page_init+0x2db>
                begin = freemem;
c0103d18:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103d1b:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0103d1e:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
            }
            if (end > KMEMSIZE) {
c0103d25:	ba 00 00 00 38       	mov    $0x38000000,%edx
c0103d2a:	b8 00 00 00 00       	mov    $0x0,%eax
c0103d2f:	3b 55 c8             	cmp    -0x38(%ebp),%edx
c0103d32:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c0103d35:	73 0e                	jae    c0103d45 <page_init+0x2fb>
                end = KMEMSIZE;
c0103d37:	c7 45 c8 00 00 00 38 	movl   $0x38000000,-0x38(%ebp)
c0103d3e:	c7 45 cc 00 00 00 00 	movl   $0x0,-0x34(%ebp)
            }
            if (begin < end) {
c0103d45:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103d48:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103d4b:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c0103d4e:	89 d0                	mov    %edx,%eax
c0103d50:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c0103d53:	0f 83 8f 00 00 00    	jae    c0103de8 <page_init+0x39e>
                begin = ROUNDUP(begin, PGSIZE);
c0103d59:	c7 45 b0 00 10 00 00 	movl   $0x1000,-0x50(%ebp)
c0103d60:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0103d63:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0103d66:	01 d0                	add    %edx,%eax
c0103d68:	48                   	dec    %eax
c0103d69:	89 45 ac             	mov    %eax,-0x54(%ebp)
c0103d6c:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0103d6f:	ba 00 00 00 00       	mov    $0x0,%edx
c0103d74:	f7 75 b0             	divl   -0x50(%ebp)
c0103d77:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0103d7a:	29 d0                	sub    %edx,%eax
c0103d7c:	ba 00 00 00 00       	mov    $0x0,%edx
c0103d81:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0103d84:	89 55 d4             	mov    %edx,-0x2c(%ebp)
                end = ROUNDDOWN(end, PGSIZE);
c0103d87:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0103d8a:	89 45 a8             	mov    %eax,-0x58(%ebp)
c0103d8d:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0103d90:	ba 00 00 00 00       	mov    $0x0,%edx
c0103d95:	89 c3                	mov    %eax,%ebx
c0103d97:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
c0103d9d:	89 de                	mov    %ebx,%esi
c0103d9f:	89 d0                	mov    %edx,%eax
c0103da1:	83 e0 00             	and    $0x0,%eax
c0103da4:	89 c7                	mov    %eax,%edi
c0103da6:	89 75 c8             	mov    %esi,-0x38(%ebp)
c0103da9:	89 7d cc             	mov    %edi,-0x34(%ebp)
                if (begin < end) {
c0103dac:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103daf:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103db2:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c0103db5:	89 d0                	mov    %edx,%eax
c0103db7:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c0103dba:	73 2c                	jae    c0103de8 <page_init+0x39e>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
c0103dbc:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0103dbf:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0103dc2:	2b 45 d0             	sub    -0x30(%ebp),%eax
c0103dc5:	1b 55 d4             	sbb    -0x2c(%ebp),%edx
c0103dc8:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0103dcc:	c1 ea 0c             	shr    $0xc,%edx
c0103dcf:	89 c3                	mov    %eax,%ebx
c0103dd1:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103dd4:	89 04 24             	mov    %eax,(%esp)
c0103dd7:	e8 94 f8 ff ff       	call   c0103670 <pa2page>
c0103ddc:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0103de0:	89 04 24             	mov    %eax,(%esp)
c0103de3:	e8 69 fb ff ff       	call   c0103951 <init_memmap>
    for (i = 0; i < memmap->nr_map; i ++) {
c0103de8:	ff 45 dc             	incl   -0x24(%ebp)
c0103deb:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0103dee:	8b 00                	mov    (%eax),%eax
c0103df0:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0103df3:	0f 8c a7 fe ff ff    	jl     c0103ca0 <page_init+0x256>
                }
            }
        }
    }
}
c0103df9:	90                   	nop
c0103dfa:	90                   	nop
c0103dfb:	81 c4 9c 00 00 00    	add    $0x9c,%esp
c0103e01:	5b                   	pop    %ebx
c0103e02:	5e                   	pop    %esi
c0103e03:	5f                   	pop    %edi
c0103e04:	5d                   	pop    %ebp
c0103e05:	c3                   	ret    

c0103e06 <boot_map_segment>:
//  la:   linear address of this memory need to map (after x86 segment map)
//  size: memory size
//  pa:   physical address of this memory
//  perm: permission of this memory  
static void
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
c0103e06:	f3 0f 1e fb          	endbr32 
c0103e0a:	55                   	push   %ebp
c0103e0b:	89 e5                	mov    %esp,%ebp
c0103e0d:	83 ec 38             	sub    $0x38,%esp
    assert(PGOFF(la) == PGOFF(pa));
c0103e10:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103e13:	33 45 14             	xor    0x14(%ebp),%eax
c0103e16:	25 ff 0f 00 00       	and    $0xfff,%eax
c0103e1b:	85 c0                	test   %eax,%eax
c0103e1d:	74 24                	je     c0103e43 <boot_map_segment+0x3d>
c0103e1f:	c7 44 24 0c 56 cc 10 	movl   $0xc010cc56,0xc(%esp)
c0103e26:	c0 
c0103e27:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0103e2e:	c0 
c0103e2f:	c7 44 24 04 08 01 00 	movl   $0x108,0x4(%esp)
c0103e36:	00 
c0103e37:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0103e3e:	e8 fa c5 ff ff       	call   c010043d <__panic>
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
c0103e43:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
c0103e4a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103e4d:	25 ff 0f 00 00       	and    $0xfff,%eax
c0103e52:	89 c2                	mov    %eax,%edx
c0103e54:	8b 45 10             	mov    0x10(%ebp),%eax
c0103e57:	01 c2                	add    %eax,%edx
c0103e59:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103e5c:	01 d0                	add    %edx,%eax
c0103e5e:	48                   	dec    %eax
c0103e5f:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0103e62:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103e65:	ba 00 00 00 00       	mov    $0x0,%edx
c0103e6a:	f7 75 f0             	divl   -0x10(%ebp)
c0103e6d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103e70:	29 d0                	sub    %edx,%eax
c0103e72:	c1 e8 0c             	shr    $0xc,%eax
c0103e75:	89 45 f4             	mov    %eax,-0xc(%ebp)
    la = ROUNDDOWN(la, PGSIZE);
c0103e78:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103e7b:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0103e7e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103e81:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103e86:	89 45 0c             	mov    %eax,0xc(%ebp)
    pa = ROUNDDOWN(pa, PGSIZE);
c0103e89:	8b 45 14             	mov    0x14(%ebp),%eax
c0103e8c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0103e8f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103e92:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103e97:	89 45 14             	mov    %eax,0x14(%ebp)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0103e9a:	eb 68                	jmp    c0103f04 <boot_map_segment+0xfe>
        pte_t *ptep = get_pte(pgdir, la, 1);
c0103e9c:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0103ea3:	00 
c0103ea4:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103ea7:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103eab:	8b 45 08             	mov    0x8(%ebp),%eax
c0103eae:	89 04 24             	mov    %eax,(%esp)
c0103eb1:	e8 8f 01 00 00       	call   c0104045 <get_pte>
c0103eb6:	89 45 e0             	mov    %eax,-0x20(%ebp)
        assert(ptep != NULL);
c0103eb9:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0103ebd:	75 24                	jne    c0103ee3 <boot_map_segment+0xdd>
c0103ebf:	c7 44 24 0c 82 cc 10 	movl   $0xc010cc82,0xc(%esp)
c0103ec6:	c0 
c0103ec7:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0103ece:	c0 
c0103ecf:	c7 44 24 04 0e 01 00 	movl   $0x10e,0x4(%esp)
c0103ed6:	00 
c0103ed7:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0103ede:	e8 5a c5 ff ff       	call   c010043d <__panic>
        *ptep = pa | PTE_P | perm;
c0103ee3:	8b 45 14             	mov    0x14(%ebp),%eax
c0103ee6:	0b 45 18             	or     0x18(%ebp),%eax
c0103ee9:	83 c8 01             	or     $0x1,%eax
c0103eec:	89 c2                	mov    %eax,%edx
c0103eee:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103ef1:	89 10                	mov    %edx,(%eax)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0103ef3:	ff 4d f4             	decl   -0xc(%ebp)
c0103ef6:	81 45 0c 00 10 00 00 	addl   $0x1000,0xc(%ebp)
c0103efd:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
c0103f04:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103f08:	75 92                	jne    c0103e9c <boot_map_segment+0x96>
    }
}
c0103f0a:	90                   	nop
c0103f0b:	90                   	nop
c0103f0c:	c9                   	leave  
c0103f0d:	c3                   	ret    

c0103f0e <boot_alloc_page>:

//boot_alloc_page - allocate one page using pmm->alloc_pages(1) 
// return value: the kernel virtual address of this allocated page
//note: this function is used to get the memory for PDT(Page Directory Table)&PT(Page Table)
static void *
boot_alloc_page(void) {
c0103f0e:	f3 0f 1e fb          	endbr32 
c0103f12:	55                   	push   %ebp
c0103f13:	89 e5                	mov    %esp,%ebp
c0103f15:	83 ec 28             	sub    $0x28,%esp
    struct Page *p = alloc_page();
c0103f18:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103f1f:	e8 51 fa ff ff       	call   c0103975 <alloc_pages>
c0103f24:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (p == NULL) {
c0103f27:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103f2b:	75 1c                	jne    c0103f49 <boot_alloc_page+0x3b>
        panic("boot_alloc_page failed.\n");
c0103f2d:	c7 44 24 08 8f cc 10 	movl   $0xc010cc8f,0x8(%esp)
c0103f34:	c0 
c0103f35:	c7 44 24 04 1a 01 00 	movl   $0x11a,0x4(%esp)
c0103f3c:	00 
c0103f3d:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0103f44:	e8 f4 c4 ff ff       	call   c010043d <__panic>
    }
    return page2kva(p);
c0103f49:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103f4c:	89 04 24             	mov    %eax,(%esp)
c0103f4f:	e8 61 f7 ff ff       	call   c01036b5 <page2kva>
}
c0103f54:	c9                   	leave  
c0103f55:	c3                   	ret    

c0103f56 <pmm_init>:

//pmm_init - setup a pmm to manage physical memory, build PDT&PT to setup paging mechanism 
//         - check the correctness of pmm & paging mechanism, print PDT&PT
void
pmm_init(void) {
c0103f56:	f3 0f 1e fb          	endbr32 
c0103f5a:	55                   	push   %ebp
c0103f5b:	89 e5                	mov    %esp,%ebp
c0103f5d:	83 ec 38             	sub    $0x38,%esp
    // We've already enabled paging
    boot_cr3 = PADDR(boot_pgdir);
c0103f60:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0103f65:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103f68:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0103f6f:	77 23                	ja     c0103f94 <pmm_init+0x3e>
c0103f71:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103f74:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103f78:	c7 44 24 08 24 cc 10 	movl   $0xc010cc24,0x8(%esp)
c0103f7f:	c0 
c0103f80:	c7 44 24 04 24 01 00 	movl   $0x124,0x4(%esp)
c0103f87:	00 
c0103f88:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0103f8f:	e8 a9 c4 ff ff       	call   c010043d <__panic>
c0103f94:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103f97:	05 00 00 00 40       	add    $0x40000000,%eax
c0103f9c:	a3 5c 40 1b c0       	mov    %eax,0xc01b405c
    //We need to alloc/free the physical memory (granularity is 4KB or other size). 
    //So a framework of physical memory manager (struct pmm_manager)is defined in pmm.h
    //First we should init a physical memory manager(pmm) based on the framework.
    //Then pmm can alloc/free the physical memory. 
    //Now the first_fit/best_fit/worst_fit/buddy_system pmm are available.
    init_pmm_manager();
c0103fa1:	e8 73 f9 ff ff       	call   c0103919 <init_pmm_manager>

    // detect physical memory space, reserve already used memory,
    // then use pmm->init_memmap to create free page list
    page_init();
c0103fa6:	e8 9f fa ff ff       	call   c0103a4a <page_init>

    //use pmm->check to verify the correctness of the alloc/free function in a pmm
    check_alloc_page();
c0103fab:	e8 fc 08 00 00       	call   c01048ac <check_alloc_page>

    check_pgdir();
c0103fb0:	e8 1a 09 00 00       	call   c01048cf <check_pgdir>

    static_assert(KERNBASE % PTSIZE == 0 && KERNTOP % PTSIZE == 0);

    // recursively insert boot_pgdir in itself
    // to form a virtual page table at virtual address VPT
    boot_pgdir[PDX(VPT)] = PADDR(boot_pgdir) | PTE_P | PTE_W;
c0103fb5:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0103fba:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103fbd:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c0103fc4:	77 23                	ja     c0103fe9 <pmm_init+0x93>
c0103fc6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103fc9:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0103fcd:	c7 44 24 08 24 cc 10 	movl   $0xc010cc24,0x8(%esp)
c0103fd4:	c0 
c0103fd5:	c7 44 24 04 3a 01 00 	movl   $0x13a,0x4(%esp)
c0103fdc:	00 
c0103fdd:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0103fe4:	e8 54 c4 ff ff       	call   c010043d <__panic>
c0103fe9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103fec:	8d 90 00 00 00 40    	lea    0x40000000(%eax),%edx
c0103ff2:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0103ff7:	05 ac 0f 00 00       	add    $0xfac,%eax
c0103ffc:	83 ca 03             	or     $0x3,%edx
c0103fff:	89 10                	mov    %edx,(%eax)

    // map all physical memory to linear memory with base linear addr KERNBASE
    // linear_addr KERNBASE ~ KERNBASE + KMEMSIZE = phy_addr 0 ~ KMEMSIZE
    boot_map_segment(boot_pgdir, KERNBASE, KMEMSIZE, 0, PTE_W);
c0104001:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104006:	c7 44 24 10 02 00 00 	movl   $0x2,0x10(%esp)
c010400d:	00 
c010400e:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0104015:	00 
c0104016:	c7 44 24 08 00 00 00 	movl   $0x38000000,0x8(%esp)
c010401d:	38 
c010401e:	c7 44 24 04 00 00 00 	movl   $0xc0000000,0x4(%esp)
c0104025:	c0 
c0104026:	89 04 24             	mov    %eax,(%esp)
c0104029:	e8 d8 fd ff ff       	call   c0103e06 <boot_map_segment>

    // Since we are using bootloader's GDT,
    // we should reload gdt (second time, the last time) to get user segments and the TSS
    // map virtual_addr 0 ~ 4G = linear_addr 0 ~ 4G
    // then set kernel stack (ss:esp) in TSS, setup TSS in gdt, load TSS
    gdt_init();
c010402e:	e8 f8 f7 ff ff       	call   c010382b <gdt_init>

    //now the basic virtual memory map(see memalyout.h) is established.
    //check the correctness of the basic virtual memory map.
    check_boot_pgdir();
c0104033:	e8 37 0f 00 00       	call   c0104f6f <check_boot_pgdir>

    print_pgdir();
c0104038:	e8 bc 13 00 00       	call   c01053f9 <print_pgdir>
    
    kmalloc_init();
c010403d:	e8 70 31 00 00       	call   c01071b2 <kmalloc_init>

}
c0104042:	90                   	nop
c0104043:	c9                   	leave  
c0104044:	c3                   	ret    

c0104045 <get_pte>:
//  pgdir:  the kernel virtual base address of PDT
//  la:     the linear address need to map
//  create: a logical value to decide if alloc a page for PT
// return vaule: the kernel virtual address of this pte
pte_t *
get_pte(pde_t *pgdir, uintptr_t la, bool create) {
c0104045:	f3 0f 1e fb          	endbr32 
c0104049:	55                   	push   %ebp
c010404a:	89 e5                	mov    %esp,%ebp
c010404c:	83 ec 38             	sub    $0x38,%esp
     * DEFINEs:
     *   PTE_P           0x001                   // page table/directory entry flags bit : Present
     *   PTE_W           0x002                   // page table/directory entry flags bit : Writeable
     *   PTE_U           0x004                   // page table/directory entry flags bit : User can access
     */
    pde_t *pdep = &pgdir[PDX(la)];   // (1) find page directory entry
c010404f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104052:	c1 e8 16             	shr    $0x16,%eax
c0104055:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c010405c:	8b 45 08             	mov    0x8(%ebp),%eax
c010405f:	01 d0                	add    %edx,%eax
c0104061:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (!(*pdep&PTE_P)) {              // (2) check if entry is not present
c0104064:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104067:	8b 00                	mov    (%eax),%eax
c0104069:	83 e0 01             	and    $0x1,%eax
c010406c:	85 c0                	test   %eax,%eax
c010406e:	0f 85 af 00 00 00    	jne    c0104123 <get_pte+0xde>
        struct Page* target;
	if(!create||!(target=alloc_page()))            // (3) check if creating is needed, then alloc page for page table
c0104074:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0104078:	74 15                	je     c010408f <get_pte+0x4a>
c010407a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104081:	e8 ef f8 ff ff       	call   c0103975 <alloc_pages>
c0104086:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104089:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010408d:	75 0a                	jne    c0104099 <get_pte+0x54>
	    return NULL;             // CAUTION: this page is used for page table, not for common data page
c010408f:	b8 00 00 00 00       	mov    $0x0,%eax
c0104094:	e9 e7 00 00 00       	jmp    c0104180 <get_pte+0x13b>
        set_page_ref(target,1);                  // (4) set page reference
c0104099:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01040a0:	00 
c01040a1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01040a4:	89 04 24             	mov    %eax,(%esp)
c01040a7:	e8 bd f6 ff ff       	call   c0103769 <set_page_ref>
        uintptr_t pa = page2pa(target); // (5) get linear address of page
c01040ac:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01040af:	89 04 24             	mov    %eax,(%esp)
c01040b2:	e8 a3 f5 ff ff       	call   c010365a <page2pa>
c01040b7:	89 45 ec             	mov    %eax,-0x14(%ebp)
        memset(KADDR(pa),0,PGSIZE);// (6) clear page content using memset
c01040ba:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01040bd:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01040c0:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01040c3:	c1 e8 0c             	shr    $0xc,%eax
c01040c6:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01040c9:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c01040ce:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c01040d1:	72 23                	jb     c01040f6 <get_pte+0xb1>
c01040d3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01040d6:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01040da:	c7 44 24 08 80 cb 10 	movl   $0xc010cb80,0x8(%esp)
c01040e1:	c0 
c01040e2:	c7 44 24 04 75 01 00 	movl   $0x175,0x4(%esp)
c01040e9:	00 
c01040ea:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01040f1:	e8 47 c3 ff ff       	call   c010043d <__panic>
c01040f6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01040f9:	2d 00 00 00 40       	sub    $0x40000000,%eax
c01040fe:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0104105:	00 
c0104106:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010410d:	00 
c010410e:	89 04 24             	mov    %eax,(%esp)
c0104111:	e8 17 77 00 00       	call   c010b82d <memset>
        *pdep=pa|PTE_P|PTE_W|PTE_U;                  // (7) set page directory entry's permission
c0104116:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104119:	83 c8 07             	or     $0x7,%eax
c010411c:	89 c2                	mov    %eax,%edx
c010411e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104121:	89 10                	mov    %edx,(%eax)
    }
    return &((pte_t *)KADDR(PDE_ADDR(*pdep)))[PTX(la)];          // (8) return page table entry
c0104123:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104126:	8b 00                	mov    (%eax),%eax
c0104128:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010412d:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104130:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104133:	c1 e8 0c             	shr    $0xc,%eax
c0104136:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0104139:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c010413e:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0104141:	72 23                	jb     c0104166 <get_pte+0x121>
c0104143:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104146:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010414a:	c7 44 24 08 80 cb 10 	movl   $0xc010cb80,0x8(%esp)
c0104151:	c0 
c0104152:	c7 44 24 04 78 01 00 	movl   $0x178,0x4(%esp)
c0104159:	00 
c010415a:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104161:	e8 d7 c2 ff ff       	call   c010043d <__panic>
c0104166:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104169:	2d 00 00 00 40       	sub    $0x40000000,%eax
c010416e:	89 c2                	mov    %eax,%edx
c0104170:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104173:	c1 e8 0c             	shr    $0xc,%eax
c0104176:	25 ff 03 00 00       	and    $0x3ff,%eax
c010417b:	c1 e0 02             	shl    $0x2,%eax
c010417e:	01 d0                	add    %edx,%eax
}
c0104180:	c9                   	leave  
c0104181:	c3                   	ret    

c0104182 <get_page>:

//get_page - get related Page struct for linear address la using PDT pgdir
struct Page *
get_page(pde_t *pgdir, uintptr_t la, pte_t **ptep_store) {
c0104182:	f3 0f 1e fb          	endbr32 
c0104186:	55                   	push   %ebp
c0104187:	89 e5                	mov    %esp,%ebp
c0104189:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c010418c:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104193:	00 
c0104194:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104197:	89 44 24 04          	mov    %eax,0x4(%esp)
c010419b:	8b 45 08             	mov    0x8(%ebp),%eax
c010419e:	89 04 24             	mov    %eax,(%esp)
c01041a1:	e8 9f fe ff ff       	call   c0104045 <get_pte>
c01041a6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep_store != NULL) {
c01041a9:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01041ad:	74 08                	je     c01041b7 <get_page+0x35>
        *ptep_store = ptep;
c01041af:	8b 45 10             	mov    0x10(%ebp),%eax
c01041b2:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01041b5:	89 10                	mov    %edx,(%eax)
    }
    if (ptep != NULL && *ptep & PTE_P) {
c01041b7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01041bb:	74 1b                	je     c01041d8 <get_page+0x56>
c01041bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01041c0:	8b 00                	mov    (%eax),%eax
c01041c2:	83 e0 01             	and    $0x1,%eax
c01041c5:	85 c0                	test   %eax,%eax
c01041c7:	74 0f                	je     c01041d8 <get_page+0x56>
        return pte2page(*ptep);
c01041c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01041cc:	8b 00                	mov    (%eax),%eax
c01041ce:	89 04 24             	mov    %eax,(%esp)
c01041d1:	e8 33 f5 ff ff       	call   c0103709 <pte2page>
c01041d6:	eb 05                	jmp    c01041dd <get_page+0x5b>
    }
    return NULL;
c01041d8:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01041dd:	c9                   	leave  
c01041de:	c3                   	ret    

c01041df <page_remove_pte>:

//page_remove_pte - free an Page sturct which is related linear address la
//                - and clean(invalidate) pte which is related linear address la
//note: PT is changed, so the TLB need to be invalidate 
static inline void
page_remove_pte(pde_t *pgdir, uintptr_t la, pte_t *ptep) {
c01041df:	55                   	push   %ebp
c01041e0:	89 e5                	mov    %esp,%ebp
c01041e2:	83 ec 28             	sub    $0x28,%esp
     *   tlb_invalidate(pde_t *pgdir, uintptr_t la) : Invalidate a TLB entry, but only if the page tables being
     *                        edited are the ones currently in use by the processor.
     * DEFINEs:
     *   PTE_P           0x001                   // page table/directory entry flags bit : Present
     */
    if (PTE_P&(*ptep)) {                      //(1) check if this page table entry is present
c01041e5:	8b 45 10             	mov    0x10(%ebp),%eax
c01041e8:	8b 00                	mov    (%eax),%eax
c01041ea:	83 e0 01             	and    $0x1,%eax
c01041ed:	85 c0                	test   %eax,%eax
c01041ef:	74 52                	je     c0104243 <page_remove_pte+0x64>
        struct Page *page = pte2page(*ptep); //(2) find corresponding page to pte
c01041f1:	8b 45 10             	mov    0x10(%ebp),%eax
c01041f4:	8b 00                	mov    (%eax),%eax
c01041f6:	89 04 24             	mov    %eax,(%esp)
c01041f9:	e8 0b f5 ff ff       	call   c0103709 <pte2page>
c01041fe:	89 45 f4             	mov    %eax,-0xc(%ebp)
        page_ref_dec(page);                    //(3) decrease page reference
c0104201:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104204:	89 04 24             	mov    %eax,(%esp)
c0104207:	e8 82 f5 ff ff       	call   c010378e <page_ref_dec>
        if(!page->ref)   free_page(page);      //(4) and free this page when page reference reachs 0
c010420c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010420f:	8b 00                	mov    (%eax),%eax
c0104211:	85 c0                	test   %eax,%eax
c0104213:	75 13                	jne    c0104228 <page_remove_pte+0x49>
c0104215:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010421c:	00 
c010421d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104220:	89 04 24             	mov    %eax,(%esp)
c0104223:	e8 bc f7 ff ff       	call   c01039e4 <free_pages>
        *ptep=0;                          //(5) clear second page table entry
c0104228:	8b 45 10             	mov    0x10(%ebp),%eax
c010422b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        tlb_invalidate(pgdir,la);               //(6) flush tlb
c0104231:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104234:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104238:	8b 45 08             	mov    0x8(%ebp),%eax
c010423b:	89 04 24             	mov    %eax,(%esp)
c010423e:	e8 30 05 00 00       	call   c0104773 <tlb_invalidate>
    }
}
c0104243:	90                   	nop
c0104244:	c9                   	leave  
c0104245:	c3                   	ret    

c0104246 <unmap_range>:

void
unmap_range(pde_t *pgdir, uintptr_t start, uintptr_t end) {
c0104246:	f3 0f 1e fb          	endbr32 
c010424a:	55                   	push   %ebp
c010424b:	89 e5                	mov    %esp,%ebp
c010424d:	83 ec 28             	sub    $0x28,%esp
    assert(start % PGSIZE == 0 && end % PGSIZE == 0);
c0104250:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104253:	25 ff 0f 00 00       	and    $0xfff,%eax
c0104258:	85 c0                	test   %eax,%eax
c010425a:	75 0c                	jne    c0104268 <unmap_range+0x22>
c010425c:	8b 45 10             	mov    0x10(%ebp),%eax
c010425f:	25 ff 0f 00 00       	and    $0xfff,%eax
c0104264:	85 c0                	test   %eax,%eax
c0104266:	74 24                	je     c010428c <unmap_range+0x46>
c0104268:	c7 44 24 0c a8 cc 10 	movl   $0xc010cca8,0xc(%esp)
c010426f:	c0 
c0104270:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104277:	c0 
c0104278:	c7 44 24 04 a8 01 00 	movl   $0x1a8,0x4(%esp)
c010427f:	00 
c0104280:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104287:	e8 b1 c1 ff ff       	call   c010043d <__panic>
    assert(USER_ACCESS(start, end));
c010428c:	81 7d 0c ff ff 1f 00 	cmpl   $0x1fffff,0xc(%ebp)
c0104293:	76 11                	jbe    c01042a6 <unmap_range+0x60>
c0104295:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104298:	3b 45 10             	cmp    0x10(%ebp),%eax
c010429b:	73 09                	jae    c01042a6 <unmap_range+0x60>
c010429d:	81 7d 10 00 00 00 b0 	cmpl   $0xb0000000,0x10(%ebp)
c01042a4:	76 24                	jbe    c01042ca <unmap_range+0x84>
c01042a6:	c7 44 24 0c d1 cc 10 	movl   $0xc010ccd1,0xc(%esp)
c01042ad:	c0 
c01042ae:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01042b5:	c0 
c01042b6:	c7 44 24 04 a9 01 00 	movl   $0x1a9,0x4(%esp)
c01042bd:	00 
c01042be:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01042c5:	e8 73 c1 ff ff       	call   c010043d <__panic>

    do {
        pte_t *ptep = get_pte(pgdir, start, 0);
c01042ca:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01042d1:	00 
c01042d2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01042d5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01042d9:	8b 45 08             	mov    0x8(%ebp),%eax
c01042dc:	89 04 24             	mov    %eax,(%esp)
c01042df:	e8 61 fd ff ff       	call   c0104045 <get_pte>
c01042e4:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (ptep == NULL) {
c01042e7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01042eb:	75 18                	jne    c0104305 <unmap_range+0xbf>
            start = ROUNDDOWN(start + PTSIZE, PTSIZE);
c01042ed:	8b 45 0c             	mov    0xc(%ebp),%eax
c01042f0:	05 00 00 40 00       	add    $0x400000,%eax
c01042f5:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01042f8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01042fb:	25 00 00 c0 ff       	and    $0xffc00000,%eax
c0104300:	89 45 0c             	mov    %eax,0xc(%ebp)
            continue ;
c0104303:	eb 29                	jmp    c010432e <unmap_range+0xe8>
        }
        if (*ptep != 0) {
c0104305:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104308:	8b 00                	mov    (%eax),%eax
c010430a:	85 c0                	test   %eax,%eax
c010430c:	74 19                	je     c0104327 <unmap_range+0xe1>
            page_remove_pte(pgdir, start, ptep);
c010430e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104311:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104315:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104318:	89 44 24 04          	mov    %eax,0x4(%esp)
c010431c:	8b 45 08             	mov    0x8(%ebp),%eax
c010431f:	89 04 24             	mov    %eax,(%esp)
c0104322:	e8 b8 fe ff ff       	call   c01041df <page_remove_pte>
        }
        start += PGSIZE;
c0104327:	81 45 0c 00 10 00 00 	addl   $0x1000,0xc(%ebp)
    } while (start != 0 && start < end);
c010432e:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0104332:	74 08                	je     c010433c <unmap_range+0xf6>
c0104334:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104337:	3b 45 10             	cmp    0x10(%ebp),%eax
c010433a:	72 8e                	jb     c01042ca <unmap_range+0x84>
}
c010433c:	90                   	nop
c010433d:	c9                   	leave  
c010433e:	c3                   	ret    

c010433f <exit_range>:

void
exit_range(pde_t *pgdir, uintptr_t start, uintptr_t end) {
c010433f:	f3 0f 1e fb          	endbr32 
c0104343:	55                   	push   %ebp
c0104344:	89 e5                	mov    %esp,%ebp
c0104346:	83 ec 28             	sub    $0x28,%esp
    assert(start % PGSIZE == 0 && end % PGSIZE == 0);
c0104349:	8b 45 0c             	mov    0xc(%ebp),%eax
c010434c:	25 ff 0f 00 00       	and    $0xfff,%eax
c0104351:	85 c0                	test   %eax,%eax
c0104353:	75 0c                	jne    c0104361 <exit_range+0x22>
c0104355:	8b 45 10             	mov    0x10(%ebp),%eax
c0104358:	25 ff 0f 00 00       	and    $0xfff,%eax
c010435d:	85 c0                	test   %eax,%eax
c010435f:	74 24                	je     c0104385 <exit_range+0x46>
c0104361:	c7 44 24 0c a8 cc 10 	movl   $0xc010cca8,0xc(%esp)
c0104368:	c0 
c0104369:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104370:	c0 
c0104371:	c7 44 24 04 ba 01 00 	movl   $0x1ba,0x4(%esp)
c0104378:	00 
c0104379:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104380:	e8 b8 c0 ff ff       	call   c010043d <__panic>
    assert(USER_ACCESS(start, end));
c0104385:	81 7d 0c ff ff 1f 00 	cmpl   $0x1fffff,0xc(%ebp)
c010438c:	76 11                	jbe    c010439f <exit_range+0x60>
c010438e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104391:	3b 45 10             	cmp    0x10(%ebp),%eax
c0104394:	73 09                	jae    c010439f <exit_range+0x60>
c0104396:	81 7d 10 00 00 00 b0 	cmpl   $0xb0000000,0x10(%ebp)
c010439d:	76 24                	jbe    c01043c3 <exit_range+0x84>
c010439f:	c7 44 24 0c d1 cc 10 	movl   $0xc010ccd1,0xc(%esp)
c01043a6:	c0 
c01043a7:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01043ae:	c0 
c01043af:	c7 44 24 04 bb 01 00 	movl   $0x1bb,0x4(%esp)
c01043b6:	00 
c01043b7:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01043be:	e8 7a c0 ff ff       	call   c010043d <__panic>

    start = ROUNDDOWN(start, PTSIZE);
c01043c3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01043c6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01043c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01043cc:	25 00 00 c0 ff       	and    $0xffc00000,%eax
c01043d1:	89 45 0c             	mov    %eax,0xc(%ebp)
    do {
        int pde_idx = PDX(start);
c01043d4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01043d7:	c1 e8 16             	shr    $0x16,%eax
c01043da:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (pgdir[pde_idx] & PTE_P) {
c01043dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01043e0:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01043e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01043ea:	01 d0                	add    %edx,%eax
c01043ec:	8b 00                	mov    (%eax),%eax
c01043ee:	83 e0 01             	and    $0x1,%eax
c01043f1:	85 c0                	test   %eax,%eax
c01043f3:	74 3e                	je     c0104433 <exit_range+0xf4>
            free_page(pde2page(pgdir[pde_idx]));
c01043f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01043f8:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01043ff:	8b 45 08             	mov    0x8(%ebp),%eax
c0104402:	01 d0                	add    %edx,%eax
c0104404:	8b 00                	mov    (%eax),%eax
c0104406:	89 04 24             	mov    %eax,(%esp)
c0104409:	e8 39 f3 ff ff       	call   c0103747 <pde2page>
c010440e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104415:	00 
c0104416:	89 04 24             	mov    %eax,(%esp)
c0104419:	e8 c6 f5 ff ff       	call   c01039e4 <free_pages>
            pgdir[pde_idx] = 0;
c010441e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104421:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0104428:	8b 45 08             	mov    0x8(%ebp),%eax
c010442b:	01 d0                	add    %edx,%eax
c010442d:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        }
        start += PTSIZE;
c0104433:	81 45 0c 00 00 40 00 	addl   $0x400000,0xc(%ebp)
    } while (start != 0 && start < end);
c010443a:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010443e:	74 08                	je     c0104448 <exit_range+0x109>
c0104440:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104443:	3b 45 10             	cmp    0x10(%ebp),%eax
c0104446:	72 8c                	jb     c01043d4 <exit_range+0x95>
}
c0104448:	90                   	nop
c0104449:	c9                   	leave  
c010444a:	c3                   	ret    

c010444b <copy_range>:
 * @share: flags to indicate to dup OR share. We just use dup method, so it didn't be used.
 *
 * CALL GRAPH: copy_mm-->dup_mmap-->copy_range
 */
int
copy_range(pde_t *to, pde_t *from, uintptr_t start, uintptr_t end, bool share) {
c010444b:	f3 0f 1e fb          	endbr32 
c010444f:	55                   	push   %ebp
c0104450:	89 e5                	mov    %esp,%ebp
c0104452:	53                   	push   %ebx
c0104453:	83 ec 34             	sub    $0x34,%esp
    assert(start % PGSIZE == 0 && end % PGSIZE == 0);
c0104456:	8b 45 10             	mov    0x10(%ebp),%eax
c0104459:	25 ff 0f 00 00       	and    $0xfff,%eax
c010445e:	85 c0                	test   %eax,%eax
c0104460:	75 0c                	jne    c010446e <copy_range+0x23>
c0104462:	8b 45 14             	mov    0x14(%ebp),%eax
c0104465:	25 ff 0f 00 00       	and    $0xfff,%eax
c010446a:	85 c0                	test   %eax,%eax
c010446c:	74 24                	je     c0104492 <copy_range+0x47>
c010446e:	c7 44 24 0c a8 cc 10 	movl   $0xc010cca8,0xc(%esp)
c0104475:	c0 
c0104476:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c010447d:	c0 
c010447e:	c7 44 24 04 d0 01 00 	movl   $0x1d0,0x4(%esp)
c0104485:	00 
c0104486:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c010448d:	e8 ab bf ff ff       	call   c010043d <__panic>
    assert(USER_ACCESS(start, end));
c0104492:	81 7d 10 ff ff 1f 00 	cmpl   $0x1fffff,0x10(%ebp)
c0104499:	76 11                	jbe    c01044ac <copy_range+0x61>
c010449b:	8b 45 10             	mov    0x10(%ebp),%eax
c010449e:	3b 45 14             	cmp    0x14(%ebp),%eax
c01044a1:	73 09                	jae    c01044ac <copy_range+0x61>
c01044a3:	81 7d 14 00 00 00 b0 	cmpl   $0xb0000000,0x14(%ebp)
c01044aa:	76 24                	jbe    c01044d0 <copy_range+0x85>
c01044ac:	c7 44 24 0c d1 cc 10 	movl   $0xc010ccd1,0xc(%esp)
c01044b3:	c0 
c01044b4:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01044bb:	c0 
c01044bc:	c7 44 24 04 d1 01 00 	movl   $0x1d1,0x4(%esp)
c01044c3:	00 
c01044c4:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01044cb:	e8 6d bf ff ff       	call   c010043d <__panic>
    // copy content by page unit.
    do {
        //call get_pte to find process A's pte according to the addr start
        pte_t *ptep = get_pte(from, start, 0), *nptep;
c01044d0:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01044d7:	00 
c01044d8:	8b 45 10             	mov    0x10(%ebp),%eax
c01044db:	89 44 24 04          	mov    %eax,0x4(%esp)
c01044df:	8b 45 0c             	mov    0xc(%ebp),%eax
c01044e2:	89 04 24             	mov    %eax,(%esp)
c01044e5:	e8 5b fb ff ff       	call   c0104045 <get_pte>
c01044ea:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (ptep == NULL) {
c01044ed:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01044f1:	75 1b                	jne    c010450e <copy_range+0xc3>
            start = ROUNDDOWN(start + PTSIZE, PTSIZE);
c01044f3:	8b 45 10             	mov    0x10(%ebp),%eax
c01044f6:	05 00 00 40 00       	add    $0x400000,%eax
c01044fb:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01044fe:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104501:	25 00 00 c0 ff       	and    $0xffc00000,%eax
c0104506:	89 45 10             	mov    %eax,0x10(%ebp)
            continue ;
c0104509:	e9 42 01 00 00       	jmp    c0104650 <copy_range+0x205>
        }
        //call get_pte to find process B's pte according to the addr start. If pte is NULL, just alloc a PT
        if (*ptep & PTE_P) {
c010450e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104511:	8b 00                	mov    (%eax),%eax
c0104513:	83 e0 01             	and    $0x1,%eax
c0104516:	85 c0                	test   %eax,%eax
c0104518:	0f 84 2b 01 00 00    	je     c0104649 <copy_range+0x1fe>
            if ((nptep = get_pte(to, start, 1)) == NULL) {
c010451e:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0104525:	00 
c0104526:	8b 45 10             	mov    0x10(%ebp),%eax
c0104529:	89 44 24 04          	mov    %eax,0x4(%esp)
c010452d:	8b 45 08             	mov    0x8(%ebp),%eax
c0104530:	89 04 24             	mov    %eax,(%esp)
c0104533:	e8 0d fb ff ff       	call   c0104045 <get_pte>
c0104538:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010453b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010453f:	75 0a                	jne    c010454b <copy_range+0x100>
                return -E_NO_MEM;
c0104541:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c0104546:	e9 1c 01 00 00       	jmp    c0104667 <copy_range+0x21c>
            }
        uint32_t perm = (*ptep & PTE_USER);
c010454b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010454e:	8b 00                	mov    (%eax),%eax
c0104550:	83 e0 07             	and    $0x7,%eax
c0104553:	89 45 ec             	mov    %eax,-0x14(%ebp)
        //get page from ptep
        struct Page *page = pte2page(*ptep);
c0104556:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104559:	8b 00                	mov    (%eax),%eax
c010455b:	89 04 24             	mov    %eax,(%esp)
c010455e:	e8 a6 f1 ff ff       	call   c0103709 <pte2page>
c0104563:	89 45 e8             	mov    %eax,-0x18(%ebp)
        // alloc a page for process B
        struct Page *npage=alloc_page();
c0104566:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010456d:	e8 03 f4 ff ff       	call   c0103975 <alloc_pages>
c0104572:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        assert(page!=NULL);
c0104575:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0104579:	75 24                	jne    c010459f <copy_range+0x154>
c010457b:	c7 44 24 0c e9 cc 10 	movl   $0xc010cce9,0xc(%esp)
c0104582:	c0 
c0104583:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c010458a:	c0 
c010458b:	c7 44 24 04 e4 01 00 	movl   $0x1e4,0x4(%esp)
c0104592:	00 
c0104593:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c010459a:	e8 9e be ff ff       	call   c010043d <__panic>
        assert(npage!=NULL);
c010459f:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01045a3:	75 24                	jne    c01045c9 <copy_range+0x17e>
c01045a5:	c7 44 24 0c f4 cc 10 	movl   $0xc010ccf4,0xc(%esp)
c01045ac:	c0 
c01045ad:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01045b4:	c0 
c01045b5:	c7 44 24 04 e5 01 00 	movl   $0x1e5,0x4(%esp)
c01045bc:	00 
c01045bd:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01045c4:	e8 74 be ff ff       	call   c010043d <__panic>
        int ret=0;
c01045c9:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
         * (1) find src_kvaddr: the kernel virtual address of page
         * (2) find dst_kvaddr: the kernel virtual address of npage
         * (3) memory copy from src_kvaddr to dst_kvaddr, size is PGSIZE
         * (4) build the map of phy addr of  nage with the linear addr start
         */
	memcpy(page2kva(npage),page2kva(page),PGSIZE);
c01045d0:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01045d3:	89 04 24             	mov    %eax,(%esp)
c01045d6:	e8 da f0 ff ff       	call   c01036b5 <page2kva>
c01045db:	89 c3                	mov    %eax,%ebx
c01045dd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01045e0:	89 04 24             	mov    %eax,(%esp)
c01045e3:	e8 cd f0 ff ff       	call   c01036b5 <page2kva>
c01045e8:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c01045ef:	00 
c01045f0:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c01045f4:	89 04 24             	mov    %eax,(%esp)
c01045f7:	e8 1b 73 00 00       	call   c010b917 <memcpy>
	ret=page_insert(to,npage,start,perm);
c01045fc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01045ff:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104603:	8b 45 10             	mov    0x10(%ebp),%eax
c0104606:	89 44 24 08          	mov    %eax,0x8(%esp)
c010460a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010460d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104611:	8b 45 08             	mov    0x8(%ebp),%eax
c0104614:	89 04 24             	mov    %eax,(%esp)
c0104617:	e8 9a 00 00 00       	call   c01046b6 <page_insert>
c010461c:	89 45 e0             	mov    %eax,-0x20(%ebp)
        assert(ret == 0);
c010461f:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0104623:	74 24                	je     c0104649 <copy_range+0x1fe>
c0104625:	c7 44 24 0c 00 cd 10 	movl   $0xc010cd00,0xc(%esp)
c010462c:	c0 
c010462d:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104634:	c0 
c0104635:	c7 44 24 04 f7 01 00 	movl   $0x1f7,0x4(%esp)
c010463c:	00 
c010463d:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104644:	e8 f4 bd ff ff       	call   c010043d <__panic>
        }
        start += PGSIZE;
c0104649:	81 45 10 00 10 00 00 	addl   $0x1000,0x10(%ebp)
    } while (start != 0 && start < end);
c0104650:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0104654:	74 0c                	je     c0104662 <copy_range+0x217>
c0104656:	8b 45 10             	mov    0x10(%ebp),%eax
c0104659:	3b 45 14             	cmp    0x14(%ebp),%eax
c010465c:	0f 82 6e fe ff ff    	jb     c01044d0 <copy_range+0x85>
    return 0;
c0104662:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104667:	83 c4 34             	add    $0x34,%esp
c010466a:	5b                   	pop    %ebx
c010466b:	5d                   	pop    %ebp
c010466c:	c3                   	ret    

c010466d <page_remove>:

//page_remove - free an Page which is related linear address la and has an validated pte
void
page_remove(pde_t *pgdir, uintptr_t la) {
c010466d:	f3 0f 1e fb          	endbr32 
c0104671:	55                   	push   %ebp
c0104672:	89 e5                	mov    %esp,%ebp
c0104674:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c0104677:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010467e:	00 
c010467f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104682:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104686:	8b 45 08             	mov    0x8(%ebp),%eax
c0104689:	89 04 24             	mov    %eax,(%esp)
c010468c:	e8 b4 f9 ff ff       	call   c0104045 <get_pte>
c0104691:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep != NULL) {
c0104694:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104698:	74 19                	je     c01046b3 <page_remove+0x46>
        page_remove_pte(pgdir, la, ptep);
c010469a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010469d:	89 44 24 08          	mov    %eax,0x8(%esp)
c01046a1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01046a4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01046a8:	8b 45 08             	mov    0x8(%ebp),%eax
c01046ab:	89 04 24             	mov    %eax,(%esp)
c01046ae:	e8 2c fb ff ff       	call   c01041df <page_remove_pte>
    }
}
c01046b3:	90                   	nop
c01046b4:	c9                   	leave  
c01046b5:	c3                   	ret    

c01046b6 <page_insert>:
//  la:    the linear address need to map
//  perm:  the permission of this Page which is setted in related pte
// return value: always 0
//note: PT is changed, so the TLB need to be invalidate 
int
page_insert(pde_t *pgdir, struct Page *page, uintptr_t la, uint32_t perm) {
c01046b6:	f3 0f 1e fb          	endbr32 
c01046ba:	55                   	push   %ebp
c01046bb:	89 e5                	mov    %esp,%ebp
c01046bd:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 1);
c01046c0:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c01046c7:	00 
c01046c8:	8b 45 10             	mov    0x10(%ebp),%eax
c01046cb:	89 44 24 04          	mov    %eax,0x4(%esp)
c01046cf:	8b 45 08             	mov    0x8(%ebp),%eax
c01046d2:	89 04 24             	mov    %eax,(%esp)
c01046d5:	e8 6b f9 ff ff       	call   c0104045 <get_pte>
c01046da:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep == NULL) {
c01046dd:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01046e1:	75 0a                	jne    c01046ed <page_insert+0x37>
        return -E_NO_MEM;
c01046e3:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c01046e8:	e9 84 00 00 00       	jmp    c0104771 <page_insert+0xbb>
    }
    page_ref_inc(page);
c01046ed:	8b 45 0c             	mov    0xc(%ebp),%eax
c01046f0:	89 04 24             	mov    %eax,(%esp)
c01046f3:	e8 7f f0 ff ff       	call   c0103777 <page_ref_inc>
    if (*ptep & PTE_P) {
c01046f8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01046fb:	8b 00                	mov    (%eax),%eax
c01046fd:	83 e0 01             	and    $0x1,%eax
c0104700:	85 c0                	test   %eax,%eax
c0104702:	74 3e                	je     c0104742 <page_insert+0x8c>
        struct Page *p = pte2page(*ptep);
c0104704:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104707:	8b 00                	mov    (%eax),%eax
c0104709:	89 04 24             	mov    %eax,(%esp)
c010470c:	e8 f8 ef ff ff       	call   c0103709 <pte2page>
c0104711:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (p == page) {
c0104714:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104717:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010471a:	75 0d                	jne    c0104729 <page_insert+0x73>
            page_ref_dec(page);
c010471c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010471f:	89 04 24             	mov    %eax,(%esp)
c0104722:	e8 67 f0 ff ff       	call   c010378e <page_ref_dec>
c0104727:	eb 19                	jmp    c0104742 <page_insert+0x8c>
        }
        else {
            page_remove_pte(pgdir, la, ptep);
c0104729:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010472c:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104730:	8b 45 10             	mov    0x10(%ebp),%eax
c0104733:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104737:	8b 45 08             	mov    0x8(%ebp),%eax
c010473a:	89 04 24             	mov    %eax,(%esp)
c010473d:	e8 9d fa ff ff       	call   c01041df <page_remove_pte>
        }
    }
    *ptep = page2pa(page) | PTE_P | perm;
c0104742:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104745:	89 04 24             	mov    %eax,(%esp)
c0104748:	e8 0d ef ff ff       	call   c010365a <page2pa>
c010474d:	0b 45 14             	or     0x14(%ebp),%eax
c0104750:	83 c8 01             	or     $0x1,%eax
c0104753:	89 c2                	mov    %eax,%edx
c0104755:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104758:	89 10                	mov    %edx,(%eax)
    tlb_invalidate(pgdir, la);
c010475a:	8b 45 10             	mov    0x10(%ebp),%eax
c010475d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104761:	8b 45 08             	mov    0x8(%ebp),%eax
c0104764:	89 04 24             	mov    %eax,(%esp)
c0104767:	e8 07 00 00 00       	call   c0104773 <tlb_invalidate>
    return 0;
c010476c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104771:	c9                   	leave  
c0104772:	c3                   	ret    

c0104773 <tlb_invalidate>:

// invalidate a TLB entry, but only if the page tables being
// edited are the ones currently in use by the processor.
void
tlb_invalidate(pde_t *pgdir, uintptr_t la) {
c0104773:	f3 0f 1e fb          	endbr32 
c0104777:	55                   	push   %ebp
c0104778:	89 e5                	mov    %esp,%ebp
c010477a:	83 ec 28             	sub    $0x28,%esp
}

static inline uintptr_t
rcr3(void) {
    uintptr_t cr3;
    asm volatile ("mov %%cr3, %0" : "=r" (cr3) :: "memory");
c010477d:	0f 20 d8             	mov    %cr3,%eax
c0104780:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return cr3;
c0104783:	8b 55 f0             	mov    -0x10(%ebp),%edx
    if (rcr3() == PADDR(pgdir)) {
c0104786:	8b 45 08             	mov    0x8(%ebp),%eax
c0104789:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010478c:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0104793:	77 23                	ja     c01047b8 <tlb_invalidate+0x45>
c0104795:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104798:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010479c:	c7 44 24 08 24 cc 10 	movl   $0xc010cc24,0x8(%esp)
c01047a3:	c0 
c01047a4:	c7 44 24 04 28 02 00 	movl   $0x228,0x4(%esp)
c01047ab:	00 
c01047ac:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01047b3:	e8 85 bc ff ff       	call   c010043d <__panic>
c01047b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01047bb:	05 00 00 00 40       	add    $0x40000000,%eax
c01047c0:	39 d0                	cmp    %edx,%eax
c01047c2:	75 0d                	jne    c01047d1 <tlb_invalidate+0x5e>
        invlpg((void *)la);
c01047c4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01047c7:	89 45 ec             	mov    %eax,-0x14(%ebp)
}

static inline void
invlpg(void *addr) {
    asm volatile ("invlpg (%0)" :: "r" (addr) : "memory");
c01047ca:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01047cd:	0f 01 38             	invlpg (%eax)
}
c01047d0:	90                   	nop
    }
}
c01047d1:	90                   	nop
c01047d2:	c9                   	leave  
c01047d3:	c3                   	ret    

c01047d4 <pgdir_alloc_page>:

// pgdir_alloc_page - call alloc_page & page_insert functions to 
//                  - allocate a page size memory & setup an addr map
//                  - pa<->la with linear address la and the PDT pgdir
struct Page *
pgdir_alloc_page(pde_t *pgdir, uintptr_t la, uint32_t perm) {
c01047d4:	f3 0f 1e fb          	endbr32 
c01047d8:	55                   	push   %ebp
c01047d9:	89 e5                	mov    %esp,%ebp
c01047db:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_page();
c01047de:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01047e5:	e8 8b f1 ff ff       	call   c0103975 <alloc_pages>
c01047ea:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c01047ed:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01047f1:	0f 84 b0 00 00 00    	je     c01048a7 <pgdir_alloc_page+0xd3>
        if (page_insert(pgdir, page, la, perm) != 0) {
c01047f7:	8b 45 10             	mov    0x10(%ebp),%eax
c01047fa:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01047fe:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104801:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104805:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104808:	89 44 24 04          	mov    %eax,0x4(%esp)
c010480c:	8b 45 08             	mov    0x8(%ebp),%eax
c010480f:	89 04 24             	mov    %eax,(%esp)
c0104812:	e8 9f fe ff ff       	call   c01046b6 <page_insert>
c0104817:	85 c0                	test   %eax,%eax
c0104819:	74 1a                	je     c0104835 <pgdir_alloc_page+0x61>
            free_page(page);
c010481b:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104822:	00 
c0104823:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104826:	89 04 24             	mov    %eax,(%esp)
c0104829:	e8 b6 f1 ff ff       	call   c01039e4 <free_pages>
            return NULL;
c010482e:	b8 00 00 00 00       	mov    $0x0,%eax
c0104833:	eb 75                	jmp    c01048aa <pgdir_alloc_page+0xd6>
        }
        if (swap_init_ok){
c0104835:	a1 14 20 1b c0       	mov    0xc01b2014,%eax
c010483a:	85 c0                	test   %eax,%eax
c010483c:	74 69                	je     c01048a7 <pgdir_alloc_page+0xd3>
            if(check_mm_struct!=NULL) {
c010483e:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c0104843:	85 c0                	test   %eax,%eax
c0104845:	74 60                	je     c01048a7 <pgdir_alloc_page+0xd3>
                swap_map_swappable(check_mm_struct, la, page, 0);
c0104847:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c010484c:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0104853:	00 
c0104854:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0104857:	89 54 24 08          	mov    %edx,0x8(%esp)
c010485b:	8b 55 0c             	mov    0xc(%ebp),%edx
c010485e:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104862:	89 04 24             	mov    %eax,(%esp)
c0104865:	e8 6a 2d 00 00       	call   c01075d4 <swap_map_swappable>
                page->pra_vaddr=la;
c010486a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010486d:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104870:	89 50 1c             	mov    %edx,0x1c(%eax)
                assert(page_ref(page) == 1);
c0104873:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104876:	89 04 24             	mov    %eax,(%esp)
c0104879:	e8 e1 ee ff ff       	call   c010375f <page_ref>
c010487e:	83 f8 01             	cmp    $0x1,%eax
c0104881:	74 24                	je     c01048a7 <pgdir_alloc_page+0xd3>
c0104883:	c7 44 24 0c 09 cd 10 	movl   $0xc010cd09,0xc(%esp)
c010488a:	c0 
c010488b:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104892:	c0 
c0104893:	c7 44 24 04 3c 02 00 	movl   $0x23c,0x4(%esp)
c010489a:	00 
c010489b:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01048a2:	e8 96 bb ff ff       	call   c010043d <__panic>
            }
        }

    }

    return page;
c01048a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01048aa:	c9                   	leave  
c01048ab:	c3                   	ret    

c01048ac <check_alloc_page>:

static void
check_alloc_page(void) {
c01048ac:	f3 0f 1e fb          	endbr32 
c01048b0:	55                   	push   %ebp
c01048b1:	89 e5                	mov    %esp,%ebp
c01048b3:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->check();
c01048b6:	a1 58 40 1b c0       	mov    0xc01b4058,%eax
c01048bb:	8b 40 18             	mov    0x18(%eax),%eax
c01048be:	ff d0                	call   *%eax
    cprintf("check_alloc_page() succeeded!\n");
c01048c0:	c7 04 24 20 cd 10 c0 	movl   $0xc010cd20,(%esp)
c01048c7:	e8 05 ba ff ff       	call   c01002d1 <cprintf>
}
c01048cc:	90                   	nop
c01048cd:	c9                   	leave  
c01048ce:	c3                   	ret    

c01048cf <check_pgdir>:

static void
check_pgdir(void) {
c01048cf:	f3 0f 1e fb          	endbr32 
c01048d3:	55                   	push   %ebp
c01048d4:	89 e5                	mov    %esp,%ebp
c01048d6:	83 ec 38             	sub    $0x38,%esp
    assert(npage <= KMEMSIZE / PGSIZE);
c01048d9:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c01048de:	3d 00 80 03 00       	cmp    $0x38000,%eax
c01048e3:	76 24                	jbe    c0104909 <check_pgdir+0x3a>
c01048e5:	c7 44 24 0c 3f cd 10 	movl   $0xc010cd3f,0xc(%esp)
c01048ec:	c0 
c01048ed:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01048f4:	c0 
c01048f5:	c7 44 24 04 54 02 00 	movl   $0x254,0x4(%esp)
c01048fc:	00 
c01048fd:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104904:	e8 34 bb ff ff       	call   c010043d <__panic>
    assert(boot_pgdir != NULL && (uint32_t)PGOFF(boot_pgdir) == 0);
c0104909:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c010490e:	85 c0                	test   %eax,%eax
c0104910:	74 0e                	je     c0104920 <check_pgdir+0x51>
c0104912:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104917:	25 ff 0f 00 00       	and    $0xfff,%eax
c010491c:	85 c0                	test   %eax,%eax
c010491e:	74 24                	je     c0104944 <check_pgdir+0x75>
c0104920:	c7 44 24 0c 5c cd 10 	movl   $0xc010cd5c,0xc(%esp)
c0104927:	c0 
c0104928:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c010492f:	c0 
c0104930:	c7 44 24 04 55 02 00 	movl   $0x255,0x4(%esp)
c0104937:	00 
c0104938:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c010493f:	e8 f9 ba ff ff       	call   c010043d <__panic>
    assert(get_page(boot_pgdir, 0x0, NULL) == NULL);
c0104944:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104949:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104950:	00 
c0104951:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104958:	00 
c0104959:	89 04 24             	mov    %eax,(%esp)
c010495c:	e8 21 f8 ff ff       	call   c0104182 <get_page>
c0104961:	85 c0                	test   %eax,%eax
c0104963:	74 24                	je     c0104989 <check_pgdir+0xba>
c0104965:	c7 44 24 0c 94 cd 10 	movl   $0xc010cd94,0xc(%esp)
c010496c:	c0 
c010496d:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104974:	c0 
c0104975:	c7 44 24 04 56 02 00 	movl   $0x256,0x4(%esp)
c010497c:	00 
c010497d:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104984:	e8 b4 ba ff ff       	call   c010043d <__panic>

    struct Page *p1, *p2;
    p1 = alloc_page();
c0104989:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104990:	e8 e0 ef ff ff       	call   c0103975 <alloc_pages>
c0104995:	89 45 f4             	mov    %eax,-0xc(%ebp)
    assert(page_insert(boot_pgdir, p1, 0x0, 0) == 0);
c0104998:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c010499d:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c01049a4:	00 
c01049a5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01049ac:	00 
c01049ad:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01049b0:	89 54 24 04          	mov    %edx,0x4(%esp)
c01049b4:	89 04 24             	mov    %eax,(%esp)
c01049b7:	e8 fa fc ff ff       	call   c01046b6 <page_insert>
c01049bc:	85 c0                	test   %eax,%eax
c01049be:	74 24                	je     c01049e4 <check_pgdir+0x115>
c01049c0:	c7 44 24 0c bc cd 10 	movl   $0xc010cdbc,0xc(%esp)
c01049c7:	c0 
c01049c8:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01049cf:	c0 
c01049d0:	c7 44 24 04 5a 02 00 	movl   $0x25a,0x4(%esp)
c01049d7:	00 
c01049d8:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01049df:	e8 59 ba ff ff       	call   c010043d <__panic>

    pte_t *ptep;
    assert((ptep = get_pte(boot_pgdir, 0x0, 0)) != NULL);
c01049e4:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c01049e9:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01049f0:	00 
c01049f1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01049f8:	00 
c01049f9:	89 04 24             	mov    %eax,(%esp)
c01049fc:	e8 44 f6 ff ff       	call   c0104045 <get_pte>
c0104a01:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104a04:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104a08:	75 24                	jne    c0104a2e <check_pgdir+0x15f>
c0104a0a:	c7 44 24 0c e8 cd 10 	movl   $0xc010cde8,0xc(%esp)
c0104a11:	c0 
c0104a12:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104a19:	c0 
c0104a1a:	c7 44 24 04 5d 02 00 	movl   $0x25d,0x4(%esp)
c0104a21:	00 
c0104a22:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104a29:	e8 0f ba ff ff       	call   c010043d <__panic>
    assert(pte2page(*ptep) == p1);
c0104a2e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104a31:	8b 00                	mov    (%eax),%eax
c0104a33:	89 04 24             	mov    %eax,(%esp)
c0104a36:	e8 ce ec ff ff       	call   c0103709 <pte2page>
c0104a3b:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0104a3e:	74 24                	je     c0104a64 <check_pgdir+0x195>
c0104a40:	c7 44 24 0c 15 ce 10 	movl   $0xc010ce15,0xc(%esp)
c0104a47:	c0 
c0104a48:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104a4f:	c0 
c0104a50:	c7 44 24 04 5e 02 00 	movl   $0x25e,0x4(%esp)
c0104a57:	00 
c0104a58:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104a5f:	e8 d9 b9 ff ff       	call   c010043d <__panic>
    assert(page_ref(p1) == 1);
c0104a64:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104a67:	89 04 24             	mov    %eax,(%esp)
c0104a6a:	e8 f0 ec ff ff       	call   c010375f <page_ref>
c0104a6f:	83 f8 01             	cmp    $0x1,%eax
c0104a72:	74 24                	je     c0104a98 <check_pgdir+0x1c9>
c0104a74:	c7 44 24 0c 2b ce 10 	movl   $0xc010ce2b,0xc(%esp)
c0104a7b:	c0 
c0104a7c:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104a83:	c0 
c0104a84:	c7 44 24 04 5f 02 00 	movl   $0x25f,0x4(%esp)
c0104a8b:	00 
c0104a8c:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104a93:	e8 a5 b9 ff ff       	call   c010043d <__panic>

    ptep = &((pte_t *)KADDR(PDE_ADDR(boot_pgdir[0])))[1];
c0104a98:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104a9d:	8b 00                	mov    (%eax),%eax
c0104a9f:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104aa4:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0104aa7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104aaa:	c1 e8 0c             	shr    $0xc,%eax
c0104aad:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0104ab0:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0104ab5:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c0104ab8:	72 23                	jb     c0104add <check_pgdir+0x20e>
c0104aba:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104abd:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104ac1:	c7 44 24 08 80 cb 10 	movl   $0xc010cb80,0x8(%esp)
c0104ac8:	c0 
c0104ac9:	c7 44 24 04 61 02 00 	movl   $0x261,0x4(%esp)
c0104ad0:	00 
c0104ad1:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104ad8:	e8 60 b9 ff ff       	call   c010043d <__panic>
c0104add:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104ae0:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0104ae5:	83 c0 04             	add    $0x4,%eax
c0104ae8:	89 45 f0             	mov    %eax,-0x10(%ebp)
    assert(get_pte(boot_pgdir, PGSIZE, 0) == ptep);
c0104aeb:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104af0:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104af7:	00 
c0104af8:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104aff:	00 
c0104b00:	89 04 24             	mov    %eax,(%esp)
c0104b03:	e8 3d f5 ff ff       	call   c0104045 <get_pte>
c0104b08:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0104b0b:	74 24                	je     c0104b31 <check_pgdir+0x262>
c0104b0d:	c7 44 24 0c 40 ce 10 	movl   $0xc010ce40,0xc(%esp)
c0104b14:	c0 
c0104b15:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104b1c:	c0 
c0104b1d:	c7 44 24 04 62 02 00 	movl   $0x262,0x4(%esp)
c0104b24:	00 
c0104b25:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104b2c:	e8 0c b9 ff ff       	call   c010043d <__panic>

    p2 = alloc_page();
c0104b31:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104b38:	e8 38 ee ff ff       	call   c0103975 <alloc_pages>
c0104b3d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(page_insert(boot_pgdir, p2, PGSIZE, PTE_U | PTE_W) == 0);
c0104b40:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104b45:	c7 44 24 0c 06 00 00 	movl   $0x6,0xc(%esp)
c0104b4c:	00 
c0104b4d:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0104b54:	00 
c0104b55:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0104b58:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104b5c:	89 04 24             	mov    %eax,(%esp)
c0104b5f:	e8 52 fb ff ff       	call   c01046b6 <page_insert>
c0104b64:	85 c0                	test   %eax,%eax
c0104b66:	74 24                	je     c0104b8c <check_pgdir+0x2bd>
c0104b68:	c7 44 24 0c 68 ce 10 	movl   $0xc010ce68,0xc(%esp)
c0104b6f:	c0 
c0104b70:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104b77:	c0 
c0104b78:	c7 44 24 04 65 02 00 	movl   $0x265,0x4(%esp)
c0104b7f:	00 
c0104b80:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104b87:	e8 b1 b8 ff ff       	call   c010043d <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0104b8c:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104b91:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104b98:	00 
c0104b99:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104ba0:	00 
c0104ba1:	89 04 24             	mov    %eax,(%esp)
c0104ba4:	e8 9c f4 ff ff       	call   c0104045 <get_pte>
c0104ba9:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104bac:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104bb0:	75 24                	jne    c0104bd6 <check_pgdir+0x307>
c0104bb2:	c7 44 24 0c a0 ce 10 	movl   $0xc010cea0,0xc(%esp)
c0104bb9:	c0 
c0104bba:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104bc1:	c0 
c0104bc2:	c7 44 24 04 66 02 00 	movl   $0x266,0x4(%esp)
c0104bc9:	00 
c0104bca:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104bd1:	e8 67 b8 ff ff       	call   c010043d <__panic>
    assert(*ptep & PTE_U);
c0104bd6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104bd9:	8b 00                	mov    (%eax),%eax
c0104bdb:	83 e0 04             	and    $0x4,%eax
c0104bde:	85 c0                	test   %eax,%eax
c0104be0:	75 24                	jne    c0104c06 <check_pgdir+0x337>
c0104be2:	c7 44 24 0c d0 ce 10 	movl   $0xc010ced0,0xc(%esp)
c0104be9:	c0 
c0104bea:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104bf1:	c0 
c0104bf2:	c7 44 24 04 67 02 00 	movl   $0x267,0x4(%esp)
c0104bf9:	00 
c0104bfa:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104c01:	e8 37 b8 ff ff       	call   c010043d <__panic>
    assert(*ptep & PTE_W);
c0104c06:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104c09:	8b 00                	mov    (%eax),%eax
c0104c0b:	83 e0 02             	and    $0x2,%eax
c0104c0e:	85 c0                	test   %eax,%eax
c0104c10:	75 24                	jne    c0104c36 <check_pgdir+0x367>
c0104c12:	c7 44 24 0c de ce 10 	movl   $0xc010cede,0xc(%esp)
c0104c19:	c0 
c0104c1a:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104c21:	c0 
c0104c22:	c7 44 24 04 68 02 00 	movl   $0x268,0x4(%esp)
c0104c29:	00 
c0104c2a:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104c31:	e8 07 b8 ff ff       	call   c010043d <__panic>
    assert(boot_pgdir[0] & PTE_U);
c0104c36:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104c3b:	8b 00                	mov    (%eax),%eax
c0104c3d:	83 e0 04             	and    $0x4,%eax
c0104c40:	85 c0                	test   %eax,%eax
c0104c42:	75 24                	jne    c0104c68 <check_pgdir+0x399>
c0104c44:	c7 44 24 0c ec ce 10 	movl   $0xc010ceec,0xc(%esp)
c0104c4b:	c0 
c0104c4c:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104c53:	c0 
c0104c54:	c7 44 24 04 69 02 00 	movl   $0x269,0x4(%esp)
c0104c5b:	00 
c0104c5c:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104c63:	e8 d5 b7 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 1);
c0104c68:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104c6b:	89 04 24             	mov    %eax,(%esp)
c0104c6e:	e8 ec ea ff ff       	call   c010375f <page_ref>
c0104c73:	83 f8 01             	cmp    $0x1,%eax
c0104c76:	74 24                	je     c0104c9c <check_pgdir+0x3cd>
c0104c78:	c7 44 24 0c 02 cf 10 	movl   $0xc010cf02,0xc(%esp)
c0104c7f:	c0 
c0104c80:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104c87:	c0 
c0104c88:	c7 44 24 04 6a 02 00 	movl   $0x26a,0x4(%esp)
c0104c8f:	00 
c0104c90:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104c97:	e8 a1 b7 ff ff       	call   c010043d <__panic>

    assert(page_insert(boot_pgdir, p1, PGSIZE, 0) == 0);
c0104c9c:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104ca1:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0104ca8:	00 
c0104ca9:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0104cb0:	00 
c0104cb1:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0104cb4:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104cb8:	89 04 24             	mov    %eax,(%esp)
c0104cbb:	e8 f6 f9 ff ff       	call   c01046b6 <page_insert>
c0104cc0:	85 c0                	test   %eax,%eax
c0104cc2:	74 24                	je     c0104ce8 <check_pgdir+0x419>
c0104cc4:	c7 44 24 0c 14 cf 10 	movl   $0xc010cf14,0xc(%esp)
c0104ccb:	c0 
c0104ccc:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104cd3:	c0 
c0104cd4:	c7 44 24 04 6c 02 00 	movl   $0x26c,0x4(%esp)
c0104cdb:	00 
c0104cdc:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104ce3:	e8 55 b7 ff ff       	call   c010043d <__panic>
    assert(page_ref(p1) == 2);
c0104ce8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104ceb:	89 04 24             	mov    %eax,(%esp)
c0104cee:	e8 6c ea ff ff       	call   c010375f <page_ref>
c0104cf3:	83 f8 02             	cmp    $0x2,%eax
c0104cf6:	74 24                	je     c0104d1c <check_pgdir+0x44d>
c0104cf8:	c7 44 24 0c 40 cf 10 	movl   $0xc010cf40,0xc(%esp)
c0104cff:	c0 
c0104d00:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104d07:	c0 
c0104d08:	c7 44 24 04 6d 02 00 	movl   $0x26d,0x4(%esp)
c0104d0f:	00 
c0104d10:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104d17:	e8 21 b7 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c0104d1c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104d1f:	89 04 24             	mov    %eax,(%esp)
c0104d22:	e8 38 ea ff ff       	call   c010375f <page_ref>
c0104d27:	85 c0                	test   %eax,%eax
c0104d29:	74 24                	je     c0104d4f <check_pgdir+0x480>
c0104d2b:	c7 44 24 0c 52 cf 10 	movl   $0xc010cf52,0xc(%esp)
c0104d32:	c0 
c0104d33:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104d3a:	c0 
c0104d3b:	c7 44 24 04 6e 02 00 	movl   $0x26e,0x4(%esp)
c0104d42:	00 
c0104d43:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104d4a:	e8 ee b6 ff ff       	call   c010043d <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0104d4f:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104d54:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104d5b:	00 
c0104d5c:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104d63:	00 
c0104d64:	89 04 24             	mov    %eax,(%esp)
c0104d67:	e8 d9 f2 ff ff       	call   c0104045 <get_pte>
c0104d6c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104d6f:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104d73:	75 24                	jne    c0104d99 <check_pgdir+0x4ca>
c0104d75:	c7 44 24 0c a0 ce 10 	movl   $0xc010cea0,0xc(%esp)
c0104d7c:	c0 
c0104d7d:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104d84:	c0 
c0104d85:	c7 44 24 04 6f 02 00 	movl   $0x26f,0x4(%esp)
c0104d8c:	00 
c0104d8d:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104d94:	e8 a4 b6 ff ff       	call   c010043d <__panic>
    assert(pte2page(*ptep) == p1);
c0104d99:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104d9c:	8b 00                	mov    (%eax),%eax
c0104d9e:	89 04 24             	mov    %eax,(%esp)
c0104da1:	e8 63 e9 ff ff       	call   c0103709 <pte2page>
c0104da6:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0104da9:	74 24                	je     c0104dcf <check_pgdir+0x500>
c0104dab:	c7 44 24 0c 15 ce 10 	movl   $0xc010ce15,0xc(%esp)
c0104db2:	c0 
c0104db3:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104dba:	c0 
c0104dbb:	c7 44 24 04 70 02 00 	movl   $0x270,0x4(%esp)
c0104dc2:	00 
c0104dc3:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104dca:	e8 6e b6 ff ff       	call   c010043d <__panic>
    assert((*ptep & PTE_U) == 0);
c0104dcf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104dd2:	8b 00                	mov    (%eax),%eax
c0104dd4:	83 e0 04             	and    $0x4,%eax
c0104dd7:	85 c0                	test   %eax,%eax
c0104dd9:	74 24                	je     c0104dff <check_pgdir+0x530>
c0104ddb:	c7 44 24 0c 64 cf 10 	movl   $0xc010cf64,0xc(%esp)
c0104de2:	c0 
c0104de3:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104dea:	c0 
c0104deb:	c7 44 24 04 71 02 00 	movl   $0x271,0x4(%esp)
c0104df2:	00 
c0104df3:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104dfa:	e8 3e b6 ff ff       	call   c010043d <__panic>

    page_remove(boot_pgdir, 0x0);
c0104dff:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104e04:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104e0b:	00 
c0104e0c:	89 04 24             	mov    %eax,(%esp)
c0104e0f:	e8 59 f8 ff ff       	call   c010466d <page_remove>
    assert(page_ref(p1) == 1);
c0104e14:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104e17:	89 04 24             	mov    %eax,(%esp)
c0104e1a:	e8 40 e9 ff ff       	call   c010375f <page_ref>
c0104e1f:	83 f8 01             	cmp    $0x1,%eax
c0104e22:	74 24                	je     c0104e48 <check_pgdir+0x579>
c0104e24:	c7 44 24 0c 2b ce 10 	movl   $0xc010ce2b,0xc(%esp)
c0104e2b:	c0 
c0104e2c:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104e33:	c0 
c0104e34:	c7 44 24 04 74 02 00 	movl   $0x274,0x4(%esp)
c0104e3b:	00 
c0104e3c:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104e43:	e8 f5 b5 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c0104e48:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104e4b:	89 04 24             	mov    %eax,(%esp)
c0104e4e:	e8 0c e9 ff ff       	call   c010375f <page_ref>
c0104e53:	85 c0                	test   %eax,%eax
c0104e55:	74 24                	je     c0104e7b <check_pgdir+0x5ac>
c0104e57:	c7 44 24 0c 52 cf 10 	movl   $0xc010cf52,0xc(%esp)
c0104e5e:	c0 
c0104e5f:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104e66:	c0 
c0104e67:	c7 44 24 04 75 02 00 	movl   $0x275,0x4(%esp)
c0104e6e:	00 
c0104e6f:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104e76:	e8 c2 b5 ff ff       	call   c010043d <__panic>

    page_remove(boot_pgdir, PGSIZE);
c0104e7b:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104e80:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104e87:	00 
c0104e88:	89 04 24             	mov    %eax,(%esp)
c0104e8b:	e8 dd f7 ff ff       	call   c010466d <page_remove>
    assert(page_ref(p1) == 0);
c0104e90:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104e93:	89 04 24             	mov    %eax,(%esp)
c0104e96:	e8 c4 e8 ff ff       	call   c010375f <page_ref>
c0104e9b:	85 c0                	test   %eax,%eax
c0104e9d:	74 24                	je     c0104ec3 <check_pgdir+0x5f4>
c0104e9f:	c7 44 24 0c 79 cf 10 	movl   $0xc010cf79,0xc(%esp)
c0104ea6:	c0 
c0104ea7:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104eae:	c0 
c0104eaf:	c7 44 24 04 78 02 00 	movl   $0x278,0x4(%esp)
c0104eb6:	00 
c0104eb7:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104ebe:	e8 7a b5 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c0104ec3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104ec6:	89 04 24             	mov    %eax,(%esp)
c0104ec9:	e8 91 e8 ff ff       	call   c010375f <page_ref>
c0104ece:	85 c0                	test   %eax,%eax
c0104ed0:	74 24                	je     c0104ef6 <check_pgdir+0x627>
c0104ed2:	c7 44 24 0c 52 cf 10 	movl   $0xc010cf52,0xc(%esp)
c0104ed9:	c0 
c0104eda:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104ee1:	c0 
c0104ee2:	c7 44 24 04 79 02 00 	movl   $0x279,0x4(%esp)
c0104ee9:	00 
c0104eea:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104ef1:	e8 47 b5 ff ff       	call   c010043d <__panic>

    assert(page_ref(pde2page(boot_pgdir[0])) == 1);
c0104ef6:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104efb:	8b 00                	mov    (%eax),%eax
c0104efd:	89 04 24             	mov    %eax,(%esp)
c0104f00:	e8 42 e8 ff ff       	call   c0103747 <pde2page>
c0104f05:	89 04 24             	mov    %eax,(%esp)
c0104f08:	e8 52 e8 ff ff       	call   c010375f <page_ref>
c0104f0d:	83 f8 01             	cmp    $0x1,%eax
c0104f10:	74 24                	je     c0104f36 <check_pgdir+0x667>
c0104f12:	c7 44 24 0c 8c cf 10 	movl   $0xc010cf8c,0xc(%esp)
c0104f19:	c0 
c0104f1a:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104f21:	c0 
c0104f22:	c7 44 24 04 7b 02 00 	movl   $0x27b,0x4(%esp)
c0104f29:	00 
c0104f2a:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104f31:	e8 07 b5 ff ff       	call   c010043d <__panic>
    free_page(pde2page(boot_pgdir[0]));
c0104f36:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104f3b:	8b 00                	mov    (%eax),%eax
c0104f3d:	89 04 24             	mov    %eax,(%esp)
c0104f40:	e8 02 e8 ff ff       	call   c0103747 <pde2page>
c0104f45:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104f4c:	00 
c0104f4d:	89 04 24             	mov    %eax,(%esp)
c0104f50:	e8 8f ea ff ff       	call   c01039e4 <free_pages>
    boot_pgdir[0] = 0;
c0104f55:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104f5a:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_pgdir() succeeded!\n");
c0104f60:	c7 04 24 b3 cf 10 c0 	movl   $0xc010cfb3,(%esp)
c0104f67:	e8 65 b3 ff ff       	call   c01002d1 <cprintf>
}
c0104f6c:	90                   	nop
c0104f6d:	c9                   	leave  
c0104f6e:	c3                   	ret    

c0104f6f <check_boot_pgdir>:

static void
check_boot_pgdir(void) {
c0104f6f:	f3 0f 1e fb          	endbr32 
c0104f73:	55                   	push   %ebp
c0104f74:	89 e5                	mov    %esp,%ebp
c0104f76:	83 ec 38             	sub    $0x38,%esp
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c0104f79:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0104f80:	e9 ca 00 00 00       	jmp    c010504f <check_boot_pgdir+0xe0>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
c0104f85:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104f88:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104f8b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104f8e:	c1 e8 0c             	shr    $0xc,%eax
c0104f91:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104f94:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0104f99:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0104f9c:	72 23                	jb     c0104fc1 <check_boot_pgdir+0x52>
c0104f9e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104fa1:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104fa5:	c7 44 24 08 80 cb 10 	movl   $0xc010cb80,0x8(%esp)
c0104fac:	c0 
c0104fad:	c7 44 24 04 87 02 00 	movl   $0x287,0x4(%esp)
c0104fb4:	00 
c0104fb5:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0104fbc:	e8 7c b4 ff ff       	call   c010043d <__panic>
c0104fc1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104fc4:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0104fc9:	89 c2                	mov    %eax,%edx
c0104fcb:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0104fd0:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104fd7:	00 
c0104fd8:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104fdc:	89 04 24             	mov    %eax,(%esp)
c0104fdf:	e8 61 f0 ff ff       	call   c0104045 <get_pte>
c0104fe4:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0104fe7:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0104feb:	75 24                	jne    c0105011 <check_boot_pgdir+0xa2>
c0104fed:	c7 44 24 0c d0 cf 10 	movl   $0xc010cfd0,0xc(%esp)
c0104ff4:	c0 
c0104ff5:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0104ffc:	c0 
c0104ffd:	c7 44 24 04 87 02 00 	movl   $0x287,0x4(%esp)
c0105004:	00 
c0105005:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c010500c:	e8 2c b4 ff ff       	call   c010043d <__panic>
        assert(PTE_ADDR(*ptep) == i);
c0105011:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105014:	8b 00                	mov    (%eax),%eax
c0105016:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010501b:	89 c2                	mov    %eax,%edx
c010501d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105020:	39 c2                	cmp    %eax,%edx
c0105022:	74 24                	je     c0105048 <check_boot_pgdir+0xd9>
c0105024:	c7 44 24 0c 0d d0 10 	movl   $0xc010d00d,0xc(%esp)
c010502b:	c0 
c010502c:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0105033:	c0 
c0105034:	c7 44 24 04 88 02 00 	movl   $0x288,0x4(%esp)
c010503b:	00 
c010503c:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0105043:	e8 f5 b3 ff ff       	call   c010043d <__panic>
    for (i = 0; i < npage; i += PGSIZE) {
c0105048:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
c010504f:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105052:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0105057:	39 c2                	cmp    %eax,%edx
c0105059:	0f 82 26 ff ff ff    	jb     c0104f85 <check_boot_pgdir+0x16>
    }

    assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
c010505f:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0105064:	05 ac 0f 00 00       	add    $0xfac,%eax
c0105069:	8b 00                	mov    (%eax),%eax
c010506b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105070:	89 c2                	mov    %eax,%edx
c0105072:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0105077:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010507a:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c0105081:	77 23                	ja     c01050a6 <check_boot_pgdir+0x137>
c0105083:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105086:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010508a:	c7 44 24 08 24 cc 10 	movl   $0xc010cc24,0x8(%esp)
c0105091:	c0 
c0105092:	c7 44 24 04 8b 02 00 	movl   $0x28b,0x4(%esp)
c0105099:	00 
c010509a:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01050a1:	e8 97 b3 ff ff       	call   c010043d <__panic>
c01050a6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01050a9:	05 00 00 00 40       	add    $0x40000000,%eax
c01050ae:	39 d0                	cmp    %edx,%eax
c01050b0:	74 24                	je     c01050d6 <check_boot_pgdir+0x167>
c01050b2:	c7 44 24 0c 24 d0 10 	movl   $0xc010d024,0xc(%esp)
c01050b9:	c0 
c01050ba:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01050c1:	c0 
c01050c2:	c7 44 24 04 8b 02 00 	movl   $0x28b,0x4(%esp)
c01050c9:	00 
c01050ca:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01050d1:	e8 67 b3 ff ff       	call   c010043d <__panic>

    assert(boot_pgdir[0] == 0);
c01050d6:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c01050db:	8b 00                	mov    (%eax),%eax
c01050dd:	85 c0                	test   %eax,%eax
c01050df:	74 24                	je     c0105105 <check_boot_pgdir+0x196>
c01050e1:	c7 44 24 0c 58 d0 10 	movl   $0xc010d058,0xc(%esp)
c01050e8:	c0 
c01050e9:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01050f0:	c0 
c01050f1:	c7 44 24 04 8d 02 00 	movl   $0x28d,0x4(%esp)
c01050f8:	00 
c01050f9:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0105100:	e8 38 b3 ff ff       	call   c010043d <__panic>

    struct Page *p;
    p = alloc_page();
c0105105:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010510c:	e8 64 e8 ff ff       	call   c0103975 <alloc_pages>
c0105111:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert(page_insert(boot_pgdir, p, 0x100, PTE_W) == 0);
c0105114:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0105119:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c0105120:	00 
c0105121:	c7 44 24 08 00 01 00 	movl   $0x100,0x8(%esp)
c0105128:	00 
c0105129:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010512c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105130:	89 04 24             	mov    %eax,(%esp)
c0105133:	e8 7e f5 ff ff       	call   c01046b6 <page_insert>
c0105138:	85 c0                	test   %eax,%eax
c010513a:	74 24                	je     c0105160 <check_boot_pgdir+0x1f1>
c010513c:	c7 44 24 0c 6c d0 10 	movl   $0xc010d06c,0xc(%esp)
c0105143:	c0 
c0105144:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c010514b:	c0 
c010514c:	c7 44 24 04 91 02 00 	movl   $0x291,0x4(%esp)
c0105153:	00 
c0105154:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c010515b:	e8 dd b2 ff ff       	call   c010043d <__panic>
    assert(page_ref(p) == 1);
c0105160:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105163:	89 04 24             	mov    %eax,(%esp)
c0105166:	e8 f4 e5 ff ff       	call   c010375f <page_ref>
c010516b:	83 f8 01             	cmp    $0x1,%eax
c010516e:	74 24                	je     c0105194 <check_boot_pgdir+0x225>
c0105170:	c7 44 24 0c 9a d0 10 	movl   $0xc010d09a,0xc(%esp)
c0105177:	c0 
c0105178:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c010517f:	c0 
c0105180:	c7 44 24 04 92 02 00 	movl   $0x292,0x4(%esp)
c0105187:	00 
c0105188:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c010518f:	e8 a9 b2 ff ff       	call   c010043d <__panic>
    assert(page_insert(boot_pgdir, p, 0x100 + PGSIZE, PTE_W) == 0);
c0105194:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0105199:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c01051a0:	00 
c01051a1:	c7 44 24 08 00 11 00 	movl   $0x1100,0x8(%esp)
c01051a8:	00 
c01051a9:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01051ac:	89 54 24 04          	mov    %edx,0x4(%esp)
c01051b0:	89 04 24             	mov    %eax,(%esp)
c01051b3:	e8 fe f4 ff ff       	call   c01046b6 <page_insert>
c01051b8:	85 c0                	test   %eax,%eax
c01051ba:	74 24                	je     c01051e0 <check_boot_pgdir+0x271>
c01051bc:	c7 44 24 0c ac d0 10 	movl   $0xc010d0ac,0xc(%esp)
c01051c3:	c0 
c01051c4:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01051cb:	c0 
c01051cc:	c7 44 24 04 93 02 00 	movl   $0x293,0x4(%esp)
c01051d3:	00 
c01051d4:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01051db:	e8 5d b2 ff ff       	call   c010043d <__panic>
    assert(page_ref(p) == 2);
c01051e0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01051e3:	89 04 24             	mov    %eax,(%esp)
c01051e6:	e8 74 e5 ff ff       	call   c010375f <page_ref>
c01051eb:	83 f8 02             	cmp    $0x2,%eax
c01051ee:	74 24                	je     c0105214 <check_boot_pgdir+0x2a5>
c01051f0:	c7 44 24 0c e3 d0 10 	movl   $0xc010d0e3,0xc(%esp)
c01051f7:	c0 
c01051f8:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c01051ff:	c0 
c0105200:	c7 44 24 04 94 02 00 	movl   $0x294,0x4(%esp)
c0105207:	00 
c0105208:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c010520f:	e8 29 b2 ff ff       	call   c010043d <__panic>

    const char *str = "ucore: Hello world!!";
c0105214:	c7 45 e8 f4 d0 10 c0 	movl   $0xc010d0f4,-0x18(%ebp)
    strcpy((void *)0x100, str);
c010521b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010521e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105222:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0105229:	e8 1b 63 00 00       	call   c010b549 <strcpy>
    assert(strcmp((void *)0x100, (void *)(0x100 + PGSIZE)) == 0);
c010522e:	c7 44 24 04 00 11 00 	movl   $0x1100,0x4(%esp)
c0105235:	00 
c0105236:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c010523d:	e8 85 63 00 00       	call   c010b5c7 <strcmp>
c0105242:	85 c0                	test   %eax,%eax
c0105244:	74 24                	je     c010526a <check_boot_pgdir+0x2fb>
c0105246:	c7 44 24 0c 0c d1 10 	movl   $0xc010d10c,0xc(%esp)
c010524d:	c0 
c010524e:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c0105255:	c0 
c0105256:	c7 44 24 04 98 02 00 	movl   $0x298,0x4(%esp)
c010525d:	00 
c010525e:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c0105265:	e8 d3 b1 ff ff       	call   c010043d <__panic>

    *(char *)(page2kva(p) + 0x100) = '\0';
c010526a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010526d:	89 04 24             	mov    %eax,(%esp)
c0105270:	e8 40 e4 ff ff       	call   c01036b5 <page2kva>
c0105275:	05 00 01 00 00       	add    $0x100,%eax
c010527a:	c6 00 00             	movb   $0x0,(%eax)
    assert(strlen((const char *)0x100) == 0);
c010527d:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0105284:	e8 62 62 00 00       	call   c010b4eb <strlen>
c0105289:	85 c0                	test   %eax,%eax
c010528b:	74 24                	je     c01052b1 <check_boot_pgdir+0x342>
c010528d:	c7 44 24 0c 44 d1 10 	movl   $0xc010d144,0xc(%esp)
c0105294:	c0 
c0105295:	c7 44 24 08 6d cc 10 	movl   $0xc010cc6d,0x8(%esp)
c010529c:	c0 
c010529d:	c7 44 24 04 9b 02 00 	movl   $0x29b,0x4(%esp)
c01052a4:	00 
c01052a5:	c7 04 24 48 cc 10 c0 	movl   $0xc010cc48,(%esp)
c01052ac:	e8 8c b1 ff ff       	call   c010043d <__panic>

    free_page(p);
c01052b1:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01052b8:	00 
c01052b9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01052bc:	89 04 24             	mov    %eax,(%esp)
c01052bf:	e8 20 e7 ff ff       	call   c01039e4 <free_pages>
    free_page(pde2page(boot_pgdir[0]));
c01052c4:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c01052c9:	8b 00                	mov    (%eax),%eax
c01052cb:	89 04 24             	mov    %eax,(%esp)
c01052ce:	e8 74 e4 ff ff       	call   c0103747 <pde2page>
c01052d3:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01052da:	00 
c01052db:	89 04 24             	mov    %eax,(%esp)
c01052de:	e8 01 e7 ff ff       	call   c01039e4 <free_pages>
    boot_pgdir[0] = 0;
c01052e3:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c01052e8:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_boot_pgdir() succeeded!\n");
c01052ee:	c7 04 24 68 d1 10 c0 	movl   $0xc010d168,(%esp)
c01052f5:	e8 d7 af ff ff       	call   c01002d1 <cprintf>
}
c01052fa:	90                   	nop
c01052fb:	c9                   	leave  
c01052fc:	c3                   	ret    

c01052fd <perm2str>:

//perm2str - use string 'u,r,w,-' to present the permission
static const char *
perm2str(int perm) {
c01052fd:	f3 0f 1e fb          	endbr32 
c0105301:	55                   	push   %ebp
c0105302:	89 e5                	mov    %esp,%ebp
    static char str[4];
    str[0] = (perm & PTE_U) ? 'u' : '-';
c0105304:	8b 45 08             	mov    0x8(%ebp),%eax
c0105307:	83 e0 04             	and    $0x4,%eax
c010530a:	85 c0                	test   %eax,%eax
c010530c:	74 04                	je     c0105312 <perm2str+0x15>
c010530e:	b0 75                	mov    $0x75,%al
c0105310:	eb 02                	jmp    c0105314 <perm2str+0x17>
c0105312:	b0 2d                	mov    $0x2d,%al
c0105314:	a2 08 20 1b c0       	mov    %al,0xc01b2008
    str[1] = 'r';
c0105319:	c6 05 09 20 1b c0 72 	movb   $0x72,0xc01b2009
    str[2] = (perm & PTE_W) ? 'w' : '-';
c0105320:	8b 45 08             	mov    0x8(%ebp),%eax
c0105323:	83 e0 02             	and    $0x2,%eax
c0105326:	85 c0                	test   %eax,%eax
c0105328:	74 04                	je     c010532e <perm2str+0x31>
c010532a:	b0 77                	mov    $0x77,%al
c010532c:	eb 02                	jmp    c0105330 <perm2str+0x33>
c010532e:	b0 2d                	mov    $0x2d,%al
c0105330:	a2 0a 20 1b c0       	mov    %al,0xc01b200a
    str[3] = '\0';
c0105335:	c6 05 0b 20 1b c0 00 	movb   $0x0,0xc01b200b
    return str;
c010533c:	b8 08 20 1b c0       	mov    $0xc01b2008,%eax
}
c0105341:	5d                   	pop    %ebp
c0105342:	c3                   	ret    

c0105343 <get_pgtable_items>:
//  table:       the beginning addr of table
//  left_store:  the pointer of the high side of table's next range
//  right_store: the pointer of the low side of table's next range
// return value: 0 - not a invalid item range, perm - a valid item range with perm permission 
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
c0105343:	f3 0f 1e fb          	endbr32 
c0105347:	55                   	push   %ebp
c0105348:	89 e5                	mov    %esp,%ebp
c010534a:	83 ec 10             	sub    $0x10,%esp
    if (start >= right) {
c010534d:	8b 45 10             	mov    0x10(%ebp),%eax
c0105350:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105353:	72 0d                	jb     c0105362 <get_pgtable_items+0x1f>
        return 0;
c0105355:	b8 00 00 00 00       	mov    $0x0,%eax
c010535a:	e9 98 00 00 00       	jmp    c01053f7 <get_pgtable_items+0xb4>
    }
    while (start < right && !(table[start] & PTE_P)) {
        start ++;
c010535f:	ff 45 10             	incl   0x10(%ebp)
    while (start < right && !(table[start] & PTE_P)) {
c0105362:	8b 45 10             	mov    0x10(%ebp),%eax
c0105365:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105368:	73 18                	jae    c0105382 <get_pgtable_items+0x3f>
c010536a:	8b 45 10             	mov    0x10(%ebp),%eax
c010536d:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0105374:	8b 45 14             	mov    0x14(%ebp),%eax
c0105377:	01 d0                	add    %edx,%eax
c0105379:	8b 00                	mov    (%eax),%eax
c010537b:	83 e0 01             	and    $0x1,%eax
c010537e:	85 c0                	test   %eax,%eax
c0105380:	74 dd                	je     c010535f <get_pgtable_items+0x1c>
    }
    if (start < right) {
c0105382:	8b 45 10             	mov    0x10(%ebp),%eax
c0105385:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105388:	73 68                	jae    c01053f2 <get_pgtable_items+0xaf>
        if (left_store != NULL) {
c010538a:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c010538e:	74 08                	je     c0105398 <get_pgtable_items+0x55>
            *left_store = start;
c0105390:	8b 45 18             	mov    0x18(%ebp),%eax
c0105393:	8b 55 10             	mov    0x10(%ebp),%edx
c0105396:	89 10                	mov    %edx,(%eax)
        }
        int perm = (table[start ++] & PTE_USER);
c0105398:	8b 45 10             	mov    0x10(%ebp),%eax
c010539b:	8d 50 01             	lea    0x1(%eax),%edx
c010539e:	89 55 10             	mov    %edx,0x10(%ebp)
c01053a1:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01053a8:	8b 45 14             	mov    0x14(%ebp),%eax
c01053ab:	01 d0                	add    %edx,%eax
c01053ad:	8b 00                	mov    (%eax),%eax
c01053af:	83 e0 07             	and    $0x7,%eax
c01053b2:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c01053b5:	eb 03                	jmp    c01053ba <get_pgtable_items+0x77>
            start ++;
c01053b7:	ff 45 10             	incl   0x10(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c01053ba:	8b 45 10             	mov    0x10(%ebp),%eax
c01053bd:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01053c0:	73 1d                	jae    c01053df <get_pgtable_items+0x9c>
c01053c2:	8b 45 10             	mov    0x10(%ebp),%eax
c01053c5:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01053cc:	8b 45 14             	mov    0x14(%ebp),%eax
c01053cf:	01 d0                	add    %edx,%eax
c01053d1:	8b 00                	mov    (%eax),%eax
c01053d3:	83 e0 07             	and    $0x7,%eax
c01053d6:	89 c2                	mov    %eax,%edx
c01053d8:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01053db:	39 c2                	cmp    %eax,%edx
c01053dd:	74 d8                	je     c01053b7 <get_pgtable_items+0x74>
        }
        if (right_store != NULL) {
c01053df:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c01053e3:	74 08                	je     c01053ed <get_pgtable_items+0xaa>
            *right_store = start;
c01053e5:	8b 45 1c             	mov    0x1c(%ebp),%eax
c01053e8:	8b 55 10             	mov    0x10(%ebp),%edx
c01053eb:	89 10                	mov    %edx,(%eax)
        }
        return perm;
c01053ed:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01053f0:	eb 05                	jmp    c01053f7 <get_pgtable_items+0xb4>
    }
    return 0;
c01053f2:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01053f7:	c9                   	leave  
c01053f8:	c3                   	ret    

c01053f9 <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
c01053f9:	f3 0f 1e fb          	endbr32 
c01053fd:	55                   	push   %ebp
c01053fe:	89 e5                	mov    %esp,%ebp
c0105400:	57                   	push   %edi
c0105401:	56                   	push   %esi
c0105402:	53                   	push   %ebx
c0105403:	83 ec 4c             	sub    $0x4c,%esp
    cprintf("-------------------- BEGIN --------------------\n");
c0105406:	c7 04 24 88 d1 10 c0 	movl   $0xc010d188,(%esp)
c010540d:	e8 bf ae ff ff       	call   c01002d1 <cprintf>
    size_t left, right = 0, perm;
c0105412:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0105419:	e9 fa 00 00 00       	jmp    c0105518 <print_pgdir+0x11f>
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c010541e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105421:	89 04 24             	mov    %eax,(%esp)
c0105424:	e8 d4 fe ff ff       	call   c01052fd <perm2str>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
c0105429:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c010542c:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010542f:	29 d1                	sub    %edx,%ecx
c0105431:	89 ca                	mov    %ecx,%edx
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0105433:	89 d6                	mov    %edx,%esi
c0105435:	c1 e6 16             	shl    $0x16,%esi
c0105438:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010543b:	89 d3                	mov    %edx,%ebx
c010543d:	c1 e3 16             	shl    $0x16,%ebx
c0105440:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105443:	89 d1                	mov    %edx,%ecx
c0105445:	c1 e1 16             	shl    $0x16,%ecx
c0105448:	8b 7d dc             	mov    -0x24(%ebp),%edi
c010544b:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010544e:	29 d7                	sub    %edx,%edi
c0105450:	89 fa                	mov    %edi,%edx
c0105452:	89 44 24 14          	mov    %eax,0x14(%esp)
c0105456:	89 74 24 10          	mov    %esi,0x10(%esp)
c010545a:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c010545e:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0105462:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105466:	c7 04 24 b9 d1 10 c0 	movl   $0xc010d1b9,(%esp)
c010546d:	e8 5f ae ff ff       	call   c01002d1 <cprintf>
        size_t l, r = left * NPTEENTRY;
c0105472:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105475:	c1 e0 0a             	shl    $0xa,%eax
c0105478:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c010547b:	eb 54                	jmp    c01054d1 <print_pgdir+0xd8>
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c010547d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105480:	89 04 24             	mov    %eax,(%esp)
c0105483:	e8 75 fe ff ff       	call   c01052fd <perm2str>
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
c0105488:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c010548b:	8b 55 d8             	mov    -0x28(%ebp),%edx
c010548e:	29 d1                	sub    %edx,%ecx
c0105490:	89 ca                	mov    %ecx,%edx
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c0105492:	89 d6                	mov    %edx,%esi
c0105494:	c1 e6 0c             	shl    $0xc,%esi
c0105497:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010549a:	89 d3                	mov    %edx,%ebx
c010549c:	c1 e3 0c             	shl    $0xc,%ebx
c010549f:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01054a2:	89 d1                	mov    %edx,%ecx
c01054a4:	c1 e1 0c             	shl    $0xc,%ecx
c01054a7:	8b 7d d4             	mov    -0x2c(%ebp),%edi
c01054aa:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01054ad:	29 d7                	sub    %edx,%edi
c01054af:	89 fa                	mov    %edi,%edx
c01054b1:	89 44 24 14          	mov    %eax,0x14(%esp)
c01054b5:	89 74 24 10          	mov    %esi,0x10(%esp)
c01054b9:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01054bd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01054c1:	89 54 24 04          	mov    %edx,0x4(%esp)
c01054c5:	c7 04 24 d8 d1 10 c0 	movl   $0xc010d1d8,(%esp)
c01054cc:	e8 00 ae ff ff       	call   c01002d1 <cprintf>
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c01054d1:	be 00 00 c0 fa       	mov    $0xfac00000,%esi
c01054d6:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01054d9:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01054dc:	89 d3                	mov    %edx,%ebx
c01054de:	c1 e3 0a             	shl    $0xa,%ebx
c01054e1:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01054e4:	89 d1                	mov    %edx,%ecx
c01054e6:	c1 e1 0a             	shl    $0xa,%ecx
c01054e9:	8d 55 d4             	lea    -0x2c(%ebp),%edx
c01054ec:	89 54 24 14          	mov    %edx,0x14(%esp)
c01054f0:	8d 55 d8             	lea    -0x28(%ebp),%edx
c01054f3:	89 54 24 10          	mov    %edx,0x10(%esp)
c01054f7:	89 74 24 0c          	mov    %esi,0xc(%esp)
c01054fb:	89 44 24 08          	mov    %eax,0x8(%esp)
c01054ff:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0105503:	89 0c 24             	mov    %ecx,(%esp)
c0105506:	e8 38 fe ff ff       	call   c0105343 <get_pgtable_items>
c010550b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010550e:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0105512:	0f 85 65 ff ff ff    	jne    c010547d <print_pgdir+0x84>
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0105518:	b9 00 b0 fe fa       	mov    $0xfafeb000,%ecx
c010551d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105520:	8d 55 dc             	lea    -0x24(%ebp),%edx
c0105523:	89 54 24 14          	mov    %edx,0x14(%esp)
c0105527:	8d 55 e0             	lea    -0x20(%ebp),%edx
c010552a:	89 54 24 10          	mov    %edx,0x10(%esp)
c010552e:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0105532:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105536:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
c010553d:	00 
c010553e:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0105545:	e8 f9 fd ff ff       	call   c0105343 <get_pgtable_items>
c010554a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010554d:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0105551:	0f 85 c7 fe ff ff    	jne    c010541e <print_pgdir+0x25>
        }
    }
    cprintf("--------------------- END ---------------------\n");
c0105557:	c7 04 24 fc d1 10 c0 	movl   $0xc010d1fc,(%esp)
c010555e:	e8 6e ad ff ff       	call   c01002d1 <cprintf>
}
c0105563:	90                   	nop
c0105564:	83 c4 4c             	add    $0x4c,%esp
c0105567:	5b                   	pop    %ebx
c0105568:	5e                   	pop    %esi
c0105569:	5f                   	pop    %edi
c010556a:	5d                   	pop    %ebp
c010556b:	c3                   	ret    

c010556c <_fifo_init_mm>:
 * (2) _fifo_init_mm: init pra_list_head and let  mm->sm_priv point to the addr of pra_list_head.
 *              Now, From the memory control struct mm_struct, we can access FIFO PRA
 */
static int
_fifo_init_mm(struct mm_struct *mm)
{     
c010556c:	f3 0f 1e fb          	endbr32 
c0105570:	55                   	push   %ebp
c0105571:	89 e5                	mov    %esp,%ebp
c0105573:	83 ec 10             	sub    $0x10,%esp
c0105576:	c7 45 fc 64 40 1b c0 	movl   $0xc01b4064,-0x4(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c010557d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105580:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0105583:	89 50 04             	mov    %edx,0x4(%eax)
c0105586:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105589:	8b 50 04             	mov    0x4(%eax),%edx
c010558c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010558f:	89 10                	mov    %edx,(%eax)
}
c0105591:	90                   	nop
     list_init(&pra_list_head);
     mm->sm_priv = &pra_list_head;
c0105592:	8b 45 08             	mov    0x8(%ebp),%eax
c0105595:	c7 40 14 64 40 1b c0 	movl   $0xc01b4064,0x14(%eax)
     //cprintf(" mm->sm_priv %x in fifo_init_mm\n",mm->sm_priv);
     return 0;
c010559c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01055a1:	c9                   	leave  
c01055a2:	c3                   	ret    

c01055a3 <_fifo_map_swappable>:
/*
 * (3)_fifo_map_swappable: According FIFO PRA, we should link the most recent arrival page at the back of pra_list_head qeueue
 */
static int
_fifo_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c01055a3:	f3 0f 1e fb          	endbr32 
c01055a7:	55                   	push   %ebp
c01055a8:	89 e5                	mov    %esp,%ebp
c01055aa:	83 ec 38             	sub    $0x38,%esp
    list_entry_t *head=(list_entry_t*) mm->sm_priv;
c01055ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01055b0:	8b 40 14             	mov    0x14(%eax),%eax
c01055b3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    list_entry_t *entry=&(page->pra_page_link);
c01055b6:	8b 45 10             	mov    0x10(%ebp),%eax
c01055b9:	83 c0 14             	add    $0x14,%eax
c01055bc:	89 45 f0             	mov    %eax,-0x10(%ebp)
 
    assert(entry != NULL && head != NULL);
c01055bf:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01055c3:	74 06                	je     c01055cb <_fifo_map_swappable+0x28>
c01055c5:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01055c9:	75 24                	jne    c01055ef <_fifo_map_swappable+0x4c>
c01055cb:	c7 44 24 0c 30 d2 10 	movl   $0xc010d230,0xc(%esp)
c01055d2:	c0 
c01055d3:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c01055da:	c0 
c01055db:	c7 44 24 04 32 00 00 	movl   $0x32,0x4(%esp)
c01055e2:	00 
c01055e3:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c01055ea:	e8 4e ae ff ff       	call   c010043d <__panic>
c01055ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01055f2:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01055f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01055f8:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * Insert the new element @elm *before* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_before(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm->prev, listelm);
c01055fb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01055fe:	8b 00                	mov    (%eax),%eax
c0105600:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0105603:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0105606:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0105609:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010560c:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c010560f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105612:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0105615:	89 10                	mov    %edx,(%eax)
c0105617:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010561a:	8b 10                	mov    (%eax),%edx
c010561c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010561f:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0105622:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105625:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0105628:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c010562b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010562e:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105631:	89 10                	mov    %edx,(%eax)
}
c0105633:	90                   	nop
}
c0105634:	90                   	nop
    //record the page access situlation
    /*LAB3 EXERCISE 2: YOUR CODE*/ 
    //(1)link the most recent arrival page at the back of the pra_list_head qeueue.
    list_add_before(head,entry);
    return 0;
c0105635:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010563a:	c9                   	leave  
c010563b:	c3                   	ret    

c010563c <_fifo_swap_out_victim>:
 *  (4)_fifo_swap_out_victim: According FIFO PRA, we should unlink the  earliest arrival page in front of pra_list_head qeueue,
 *                            then assign the value of *ptr_page to the addr of this page.
 */
static int
_fifo_swap_out_victim(struct mm_struct *mm, struct Page ** ptr_page, int in_tick)
{
c010563c:	f3 0f 1e fb          	endbr32 
c0105640:	55                   	push   %ebp
c0105641:	89 e5                	mov    %esp,%ebp
c0105643:	83 ec 38             	sub    $0x38,%esp
     list_entry_t *head=(list_entry_t*) mm->sm_priv;
c0105646:	8b 45 08             	mov    0x8(%ebp),%eax
c0105649:	8b 40 14             	mov    0x14(%eax),%eax
c010564c:	89 45 f4             	mov    %eax,-0xc(%ebp)
         assert(head != NULL);
c010564f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105653:	75 24                	jne    c0105679 <_fifo_swap_out_victim+0x3d>
c0105655:	c7 44 24 0c 77 d2 10 	movl   $0xc010d277,0xc(%esp)
c010565c:	c0 
c010565d:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c0105664:	c0 
c0105665:	c7 44 24 04 41 00 00 	movl   $0x41,0x4(%esp)
c010566c:	00 
c010566d:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c0105674:	e8 c4 ad ff ff       	call   c010043d <__panic>
     assert(in_tick==0);
c0105679:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010567d:	74 24                	je     c01056a3 <_fifo_swap_out_victim+0x67>
c010567f:	c7 44 24 0c 84 d2 10 	movl   $0xc010d284,0xc(%esp)
c0105686:	c0 
c0105687:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c010568e:	c0 
c010568f:	c7 44 24 04 42 00 00 	movl   $0x42,0x4(%esp)
c0105696:	00 
c0105697:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c010569e:	e8 9a ad ff ff       	call   c010043d <__panic>
     /* Select the victim */
     /*LAB3 EXERCISE 2: YOUR CODE*/ 
     //(1)  unlink the  earliest arrival page in front of pra_list_head qeueue
     //(2)  assign the value of *ptr_page to the addr of this page
     list_entry_t *le=head->next;
c01056a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01056a6:	8b 40 04             	mov    0x4(%eax),%eax
c01056a9:	89 45 f0             	mov    %eax,-0x10(%ebp)
     *ptr_page=le2page(le,pra_page_link);
c01056ac:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01056af:	8d 50 ec             	lea    -0x14(%eax),%edx
c01056b2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01056b5:	89 10                	mov    %edx,(%eax)
c01056b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01056ba:	89 45 ec             	mov    %eax,-0x14(%ebp)
    __list_del(listelm->prev, listelm->next);
c01056bd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01056c0:	8b 40 04             	mov    0x4(%eax),%eax
c01056c3:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01056c6:	8b 12                	mov    (%edx),%edx
c01056c8:	89 55 e8             	mov    %edx,-0x18(%ebp)
c01056cb:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c01056ce:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01056d1:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01056d4:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c01056d7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01056da:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01056dd:	89 10                	mov    %edx,(%eax)
}
c01056df:	90                   	nop
}
c01056e0:	90                   	nop
     list_del(le);
     return 0;
c01056e1:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01056e6:	c9                   	leave  
c01056e7:	c3                   	ret    

c01056e8 <_fifo_check_swap>:

static int
_fifo_check_swap(void) {
c01056e8:	f3 0f 1e fb          	endbr32 
c01056ec:	55                   	push   %ebp
c01056ed:	89 e5                	mov    %esp,%ebp
c01056ef:	83 ec 18             	sub    $0x18,%esp
    cprintf("write Virt Page c in fifo_check_swap\n");
c01056f2:	c7 04 24 90 d2 10 c0 	movl   $0xc010d290,(%esp)
c01056f9:	e8 d3 ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c01056fe:	b8 00 30 00 00       	mov    $0x3000,%eax
c0105703:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==4);
c0105706:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010570b:	83 f8 04             	cmp    $0x4,%eax
c010570e:	74 24                	je     c0105734 <_fifo_check_swap+0x4c>
c0105710:	c7 44 24 0c b6 d2 10 	movl   $0xc010d2b6,0xc(%esp)
c0105717:	c0 
c0105718:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c010571f:	c0 
c0105720:	c7 44 24 04 51 00 00 	movl   $0x51,0x4(%esp)
c0105727:	00 
c0105728:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c010572f:	e8 09 ad ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0105734:	c7 04 24 c8 d2 10 c0 	movl   $0xc010d2c8,(%esp)
c010573b:	e8 91 ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c0105740:	b8 00 10 00 00       	mov    $0x1000,%eax
c0105745:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==4);
c0105748:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010574d:	83 f8 04             	cmp    $0x4,%eax
c0105750:	74 24                	je     c0105776 <_fifo_check_swap+0x8e>
c0105752:	c7 44 24 0c b6 d2 10 	movl   $0xc010d2b6,0xc(%esp)
c0105759:	c0 
c010575a:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c0105761:	c0 
c0105762:	c7 44 24 04 54 00 00 	movl   $0x54,0x4(%esp)
c0105769:	00 
c010576a:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c0105771:	e8 c7 ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c0105776:	c7 04 24 f0 d2 10 c0 	movl   $0xc010d2f0,(%esp)
c010577d:	e8 4f ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c0105782:	b8 00 40 00 00       	mov    $0x4000,%eax
c0105787:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==4);
c010578a:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010578f:	83 f8 04             	cmp    $0x4,%eax
c0105792:	74 24                	je     c01057b8 <_fifo_check_swap+0xd0>
c0105794:	c7 44 24 0c b6 d2 10 	movl   $0xc010d2b6,0xc(%esp)
c010579b:	c0 
c010579c:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c01057a3:	c0 
c01057a4:	c7 44 24 04 57 00 00 	movl   $0x57,0x4(%esp)
c01057ab:	00 
c01057ac:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c01057b3:	e8 85 ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c01057b8:	c7 04 24 18 d3 10 c0 	movl   $0xc010d318,(%esp)
c01057bf:	e8 0d ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c01057c4:	b8 00 20 00 00       	mov    $0x2000,%eax
c01057c9:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==4);
c01057cc:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c01057d1:	83 f8 04             	cmp    $0x4,%eax
c01057d4:	74 24                	je     c01057fa <_fifo_check_swap+0x112>
c01057d6:	c7 44 24 0c b6 d2 10 	movl   $0xc010d2b6,0xc(%esp)
c01057dd:	c0 
c01057de:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c01057e5:	c0 
c01057e6:	c7 44 24 04 5a 00 00 	movl   $0x5a,0x4(%esp)
c01057ed:	00 
c01057ee:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c01057f5:	e8 43 ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c01057fa:	c7 04 24 40 d3 10 c0 	movl   $0xc010d340,(%esp)
c0105801:	e8 cb aa ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c0105806:	b8 00 50 00 00       	mov    $0x5000,%eax
c010580b:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==5);
c010580e:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c0105813:	83 f8 05             	cmp    $0x5,%eax
c0105816:	74 24                	je     c010583c <_fifo_check_swap+0x154>
c0105818:	c7 44 24 0c 66 d3 10 	movl   $0xc010d366,0xc(%esp)
c010581f:	c0 
c0105820:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c0105827:	c0 
c0105828:	c7 44 24 04 5d 00 00 	movl   $0x5d,0x4(%esp)
c010582f:	00 
c0105830:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c0105837:	e8 01 ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c010583c:	c7 04 24 18 d3 10 c0 	movl   $0xc010d318,(%esp)
c0105843:	e8 89 aa ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0105848:	b8 00 20 00 00       	mov    $0x2000,%eax
c010584d:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==5);
c0105850:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c0105855:	83 f8 05             	cmp    $0x5,%eax
c0105858:	74 24                	je     c010587e <_fifo_check_swap+0x196>
c010585a:	c7 44 24 0c 66 d3 10 	movl   $0xc010d366,0xc(%esp)
c0105861:	c0 
c0105862:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c0105869:	c0 
c010586a:	c7 44 24 04 60 00 00 	movl   $0x60,0x4(%esp)
c0105871:	00 
c0105872:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c0105879:	e8 bf ab ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c010587e:	c7 04 24 c8 d2 10 c0 	movl   $0xc010d2c8,(%esp)
c0105885:	e8 47 aa ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c010588a:	b8 00 10 00 00       	mov    $0x1000,%eax
c010588f:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==6);
c0105892:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c0105897:	83 f8 06             	cmp    $0x6,%eax
c010589a:	74 24                	je     c01058c0 <_fifo_check_swap+0x1d8>
c010589c:	c7 44 24 0c 75 d3 10 	movl   $0xc010d375,0xc(%esp)
c01058a3:	c0 
c01058a4:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c01058ab:	c0 
c01058ac:	c7 44 24 04 63 00 00 	movl   $0x63,0x4(%esp)
c01058b3:	00 
c01058b4:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c01058bb:	e8 7d ab ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c01058c0:	c7 04 24 18 d3 10 c0 	movl   $0xc010d318,(%esp)
c01058c7:	e8 05 aa ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c01058cc:	b8 00 20 00 00       	mov    $0x2000,%eax
c01058d1:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==7);
c01058d4:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c01058d9:	83 f8 07             	cmp    $0x7,%eax
c01058dc:	74 24                	je     c0105902 <_fifo_check_swap+0x21a>
c01058de:	c7 44 24 0c 84 d3 10 	movl   $0xc010d384,0xc(%esp)
c01058e5:	c0 
c01058e6:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c01058ed:	c0 
c01058ee:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c01058f5:	00 
c01058f6:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c01058fd:	e8 3b ab ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page c in fifo_check_swap\n");
c0105902:	c7 04 24 90 d2 10 c0 	movl   $0xc010d290,(%esp)
c0105909:	e8 c3 a9 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c010590e:	b8 00 30 00 00       	mov    $0x3000,%eax
c0105913:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==8);
c0105916:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010591b:	83 f8 08             	cmp    $0x8,%eax
c010591e:	74 24                	je     c0105944 <_fifo_check_swap+0x25c>
c0105920:	c7 44 24 0c 93 d3 10 	movl   $0xc010d393,0xc(%esp)
c0105927:	c0 
c0105928:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c010592f:	c0 
c0105930:	c7 44 24 04 69 00 00 	movl   $0x69,0x4(%esp)
c0105937:	00 
c0105938:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c010593f:	e8 f9 aa ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c0105944:	c7 04 24 f0 d2 10 c0 	movl   $0xc010d2f0,(%esp)
c010594b:	e8 81 a9 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c0105950:	b8 00 40 00 00       	mov    $0x4000,%eax
c0105955:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==9);
c0105958:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010595d:	83 f8 09             	cmp    $0x9,%eax
c0105960:	74 24                	je     c0105986 <_fifo_check_swap+0x29e>
c0105962:	c7 44 24 0c a2 d3 10 	movl   $0xc010d3a2,0xc(%esp)
c0105969:	c0 
c010596a:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c0105971:	c0 
c0105972:	c7 44 24 04 6c 00 00 	movl   $0x6c,0x4(%esp)
c0105979:	00 
c010597a:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c0105981:	e8 b7 aa ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c0105986:	c7 04 24 40 d3 10 c0 	movl   $0xc010d340,(%esp)
c010598d:	e8 3f a9 ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c0105992:	b8 00 50 00 00       	mov    $0x5000,%eax
c0105997:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==10);
c010599a:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010599f:	83 f8 0a             	cmp    $0xa,%eax
c01059a2:	74 24                	je     c01059c8 <_fifo_check_swap+0x2e0>
c01059a4:	c7 44 24 0c b1 d3 10 	movl   $0xc010d3b1,0xc(%esp)
c01059ab:	c0 
c01059ac:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c01059b3:	c0 
c01059b4:	c7 44 24 04 6f 00 00 	movl   $0x6f,0x4(%esp)
c01059bb:	00 
c01059bc:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c01059c3:	e8 75 aa ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c01059c8:	c7 04 24 c8 d2 10 c0 	movl   $0xc010d2c8,(%esp)
c01059cf:	e8 fd a8 ff ff       	call   c01002d1 <cprintf>
    assert(*(unsigned char *)0x1000 == 0x0a);
c01059d4:	b8 00 10 00 00       	mov    $0x1000,%eax
c01059d9:	0f b6 00             	movzbl (%eax),%eax
c01059dc:	3c 0a                	cmp    $0xa,%al
c01059de:	74 24                	je     c0105a04 <_fifo_check_swap+0x31c>
c01059e0:	c7 44 24 0c c4 d3 10 	movl   $0xc010d3c4,0xc(%esp)
c01059e7:	c0 
c01059e8:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c01059ef:	c0 
c01059f0:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c01059f7:	00 
c01059f8:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c01059ff:	e8 39 aa ff ff       	call   c010043d <__panic>
    *(unsigned char *)0x1000 = 0x0a;
c0105a04:	b8 00 10 00 00       	mov    $0x1000,%eax
c0105a09:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==11);
c0105a0c:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c0105a11:	83 f8 0b             	cmp    $0xb,%eax
c0105a14:	74 24                	je     c0105a3a <_fifo_check_swap+0x352>
c0105a16:	c7 44 24 0c e5 d3 10 	movl   $0xc010d3e5,0xc(%esp)
c0105a1d:	c0 
c0105a1e:	c7 44 24 08 4e d2 10 	movl   $0xc010d24e,0x8(%esp)
c0105a25:	c0 
c0105a26:	c7 44 24 04 73 00 00 	movl   $0x73,0x4(%esp)
c0105a2d:	00 
c0105a2e:	c7 04 24 63 d2 10 c0 	movl   $0xc010d263,(%esp)
c0105a35:	e8 03 aa ff ff       	call   c010043d <__panic>
    return 0;
c0105a3a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0105a3f:	c9                   	leave  
c0105a40:	c3                   	ret    

c0105a41 <_fifo_init>:


static int
_fifo_init(void)
{
c0105a41:	f3 0f 1e fb          	endbr32 
c0105a45:	55                   	push   %ebp
c0105a46:	89 e5                	mov    %esp,%ebp
    return 0;
c0105a48:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0105a4d:	5d                   	pop    %ebp
c0105a4e:	c3                   	ret    

c0105a4f <_fifo_set_unswappable>:

static int
_fifo_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c0105a4f:	f3 0f 1e fb          	endbr32 
c0105a53:	55                   	push   %ebp
c0105a54:	89 e5                	mov    %esp,%ebp
    return 0;
c0105a56:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0105a5b:	5d                   	pop    %ebp
c0105a5c:	c3                   	ret    

c0105a5d <_fifo_tick_event>:

static int
_fifo_tick_event(struct mm_struct *mm)
{ return 0; }
c0105a5d:	f3 0f 1e fb          	endbr32 
c0105a61:	55                   	push   %ebp
c0105a62:	89 e5                	mov    %esp,%ebp
c0105a64:	b8 00 00 00 00       	mov    $0x0,%eax
c0105a69:	5d                   	pop    %ebp
c0105a6a:	c3                   	ret    

c0105a6b <lock_init>:
#define local_intr_restore(x)   __intr_restore(x);

typedef volatile bool lock_t;

static inline void
lock_init(lock_t *lock) {
c0105a6b:	55                   	push   %ebp
c0105a6c:	89 e5                	mov    %esp,%ebp
    *lock = 0;
c0105a6e:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a71:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
}
c0105a77:	90                   	nop
c0105a78:	5d                   	pop    %ebp
c0105a79:	c3                   	ret    

c0105a7a <mm_count>:
bool user_mem_check(struct mm_struct *mm, uintptr_t start, size_t len, bool write);
bool copy_from_user(struct mm_struct *mm, void *dst, const void *src, size_t len, bool writable);
bool copy_to_user(struct mm_struct *mm, void *dst, const void *src, size_t len);

static inline int
mm_count(struct mm_struct *mm) {
c0105a7a:	55                   	push   %ebp
c0105a7b:	89 e5                	mov    %esp,%ebp
    return mm->mm_count;
c0105a7d:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a80:	8b 40 18             	mov    0x18(%eax),%eax
}
c0105a83:	5d                   	pop    %ebp
c0105a84:	c3                   	ret    

c0105a85 <set_mm_count>:

static inline void
set_mm_count(struct mm_struct *mm, int val) {
c0105a85:	55                   	push   %ebp
c0105a86:	89 e5                	mov    %esp,%ebp
    mm->mm_count = val;
c0105a88:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a8b:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105a8e:	89 50 18             	mov    %edx,0x18(%eax)
}
c0105a91:	90                   	nop
c0105a92:	5d                   	pop    %ebp
c0105a93:	c3                   	ret    

c0105a94 <pa2page>:
pa2page(uintptr_t pa) {
c0105a94:	55                   	push   %ebp
c0105a95:	89 e5                	mov    %esp,%ebp
c0105a97:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0105a9a:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a9d:	c1 e8 0c             	shr    $0xc,%eax
c0105aa0:	89 c2                	mov    %eax,%edx
c0105aa2:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0105aa7:	39 c2                	cmp    %eax,%edx
c0105aa9:	72 1c                	jb     c0105ac7 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0105aab:	c7 44 24 08 08 d4 10 	movl   $0xc010d408,0x8(%esp)
c0105ab2:	c0 
c0105ab3:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
c0105aba:	00 
c0105abb:	c7 04 24 27 d4 10 c0 	movl   $0xc010d427,(%esp)
c0105ac2:	e8 76 a9 ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0105ac7:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c0105acc:	8b 55 08             	mov    0x8(%ebp),%edx
c0105acf:	c1 ea 0c             	shr    $0xc,%edx
c0105ad2:	c1 e2 05             	shl    $0x5,%edx
c0105ad5:	01 d0                	add    %edx,%eax
}
c0105ad7:	c9                   	leave  
c0105ad8:	c3                   	ret    

c0105ad9 <pde2page>:
pde2page(pde_t pde) {
c0105ad9:	55                   	push   %ebp
c0105ada:	89 e5                	mov    %esp,%ebp
c0105adc:	83 ec 18             	sub    $0x18,%esp
    return pa2page(PDE_ADDR(pde));
c0105adf:	8b 45 08             	mov    0x8(%ebp),%eax
c0105ae2:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105ae7:	89 04 24             	mov    %eax,(%esp)
c0105aea:	e8 a5 ff ff ff       	call   c0105a94 <pa2page>
}
c0105aef:	c9                   	leave  
c0105af0:	c3                   	ret    

c0105af1 <mm_create>:
static void check_vma_struct(void);
static void check_pgfault(void);

// mm_create -  alloc a mm_struct & initialize it.
struct mm_struct *
mm_create(void) {
c0105af1:	f3 0f 1e fb          	endbr32 
c0105af5:	55                   	push   %ebp
c0105af6:	89 e5                	mov    %esp,%ebp
c0105af8:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm = kmalloc(sizeof(struct mm_struct));
c0105afb:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0105b02:	e8 02 18 00 00       	call   c0107309 <kmalloc>
c0105b07:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (mm != NULL) {
c0105b0a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105b0e:	74 7a                	je     c0105b8a <mm_create+0x99>
        list_init(&(mm->mmap_list));
c0105b10:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b13:	89 45 f0             	mov    %eax,-0x10(%ebp)
    elm->prev = elm->next = elm;
c0105b16:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105b19:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0105b1c:	89 50 04             	mov    %edx,0x4(%eax)
c0105b1f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105b22:	8b 50 04             	mov    0x4(%eax),%edx
c0105b25:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105b28:	89 10                	mov    %edx,(%eax)
}
c0105b2a:	90                   	nop
        mm->mmap_cache = NULL;
c0105b2b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b2e:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        mm->pgdir = NULL;
c0105b35:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b38:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        mm->map_count = 0;
c0105b3f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b42:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)

        if (swap_init_ok) swap_init_mm(mm);
c0105b49:	a1 14 20 1b c0       	mov    0xc01b2014,%eax
c0105b4e:	85 c0                	test   %eax,%eax
c0105b50:	74 0d                	je     c0105b5f <mm_create+0x6e>
c0105b52:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b55:	89 04 24             	mov    %eax,(%esp)
c0105b58:	e8 3f 1a 00 00       	call   c010759c <swap_init_mm>
c0105b5d:	eb 0a                	jmp    c0105b69 <mm_create+0x78>
        else mm->sm_priv = NULL;
c0105b5f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b62:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
        
        set_mm_count(mm, 0);
c0105b69:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105b70:	00 
c0105b71:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b74:	89 04 24             	mov    %eax,(%esp)
c0105b77:	e8 09 ff ff ff       	call   c0105a85 <set_mm_count>
        lock_init(&(mm->mm_lock));
c0105b7c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b7f:	83 c0 1c             	add    $0x1c,%eax
c0105b82:	89 04 24             	mov    %eax,(%esp)
c0105b85:	e8 e1 fe ff ff       	call   c0105a6b <lock_init>
    }    
    return mm;
c0105b8a:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0105b8d:	c9                   	leave  
c0105b8e:	c3                   	ret    

c0105b8f <vma_create>:

// vma_create - alloc a vma_struct & initialize it. (addr range: vm_start~vm_end)
struct vma_struct *
vma_create(uintptr_t vm_start, uintptr_t vm_end, uint32_t vm_flags) {
c0105b8f:	f3 0f 1e fb          	endbr32 
c0105b93:	55                   	push   %ebp
c0105b94:	89 e5                	mov    %esp,%ebp
c0105b96:	83 ec 28             	sub    $0x28,%esp
    struct vma_struct *vma = kmalloc(sizeof(struct vma_struct));
c0105b99:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c0105ba0:	e8 64 17 00 00       	call   c0107309 <kmalloc>
c0105ba5:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (vma != NULL) {
c0105ba8:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105bac:	74 1b                	je     c0105bc9 <vma_create+0x3a>
        vma->vm_start = vm_start;
c0105bae:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105bb1:	8b 55 08             	mov    0x8(%ebp),%edx
c0105bb4:	89 50 04             	mov    %edx,0x4(%eax)
        vma->vm_end = vm_end;
c0105bb7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105bba:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105bbd:	89 50 08             	mov    %edx,0x8(%eax)
        vma->vm_flags = vm_flags;
c0105bc0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105bc3:	8b 55 10             	mov    0x10(%ebp),%edx
c0105bc6:	89 50 0c             	mov    %edx,0xc(%eax)
    }
    return vma;
c0105bc9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0105bcc:	c9                   	leave  
c0105bcd:	c3                   	ret    

c0105bce <find_vma>:


// find_vma - find a vma  (vma->vm_start <= addr <= vma_vm_end)
struct vma_struct *
find_vma(struct mm_struct *mm, uintptr_t addr) {
c0105bce:	f3 0f 1e fb          	endbr32 
c0105bd2:	55                   	push   %ebp
c0105bd3:	89 e5                	mov    %esp,%ebp
c0105bd5:	83 ec 20             	sub    $0x20,%esp
    struct vma_struct *vma = NULL;
c0105bd8:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    if (mm != NULL) {
c0105bdf:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0105be3:	0f 84 95 00 00 00    	je     c0105c7e <find_vma+0xb0>
        vma = mm->mmap_cache;
c0105be9:	8b 45 08             	mov    0x8(%ebp),%eax
c0105bec:	8b 40 08             	mov    0x8(%eax),%eax
c0105bef:	89 45 fc             	mov    %eax,-0x4(%ebp)
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
c0105bf2:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0105bf6:	74 16                	je     c0105c0e <find_vma+0x40>
c0105bf8:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105bfb:	8b 40 04             	mov    0x4(%eax),%eax
c0105bfe:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0105c01:	72 0b                	jb     c0105c0e <find_vma+0x40>
c0105c03:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105c06:	8b 40 08             	mov    0x8(%eax),%eax
c0105c09:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0105c0c:	72 61                	jb     c0105c6f <find_vma+0xa1>
                bool found = 0;
c0105c0e:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
                list_entry_t *list = &(mm->mmap_list), *le = list;
c0105c15:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c18:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105c1b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105c1e:	89 45 f4             	mov    %eax,-0xc(%ebp)
                while ((le = list_next(le)) != list) {
c0105c21:	eb 28                	jmp    c0105c4b <find_vma+0x7d>
                    vma = le2vma(le, list_link);
c0105c23:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105c26:	83 e8 10             	sub    $0x10,%eax
c0105c29:	89 45 fc             	mov    %eax,-0x4(%ebp)
                    if (vma->vm_start<=addr && addr < vma->vm_end) {
c0105c2c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105c2f:	8b 40 04             	mov    0x4(%eax),%eax
c0105c32:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0105c35:	72 14                	jb     c0105c4b <find_vma+0x7d>
c0105c37:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105c3a:	8b 40 08             	mov    0x8(%eax),%eax
c0105c3d:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0105c40:	73 09                	jae    c0105c4b <find_vma+0x7d>
                        found = 1;
c0105c42:	c7 45 f8 01 00 00 00 	movl   $0x1,-0x8(%ebp)
                        break;
c0105c49:	eb 17                	jmp    c0105c62 <find_vma+0x94>
c0105c4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105c4e:	89 45 ec             	mov    %eax,-0x14(%ebp)
    return listelm->next;
c0105c51:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105c54:	8b 40 04             	mov    0x4(%eax),%eax
                while ((le = list_next(le)) != list) {
c0105c57:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105c5a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105c5d:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0105c60:	75 c1                	jne    c0105c23 <find_vma+0x55>
                    }
                }
                if (!found) {
c0105c62:	83 7d f8 00          	cmpl   $0x0,-0x8(%ebp)
c0105c66:	75 07                	jne    c0105c6f <find_vma+0xa1>
                    vma = NULL;
c0105c68:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
                }
        }
        if (vma != NULL) {
c0105c6f:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0105c73:	74 09                	je     c0105c7e <find_vma+0xb0>
            mm->mmap_cache = vma;
c0105c75:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c78:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0105c7b:	89 50 08             	mov    %edx,0x8(%eax)
        }
    }
    return vma;
c0105c7e:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0105c81:	c9                   	leave  
c0105c82:	c3                   	ret    

c0105c83 <check_vma_overlap>:


// check_vma_overlap - check if vma1 overlaps vma2 ?
static inline void
check_vma_overlap(struct vma_struct *prev, struct vma_struct *next) {
c0105c83:	55                   	push   %ebp
c0105c84:	89 e5                	mov    %esp,%ebp
c0105c86:	83 ec 18             	sub    $0x18,%esp
    assert(prev->vm_start < prev->vm_end);
c0105c89:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c8c:	8b 50 04             	mov    0x4(%eax),%edx
c0105c8f:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c92:	8b 40 08             	mov    0x8(%eax),%eax
c0105c95:	39 c2                	cmp    %eax,%edx
c0105c97:	72 24                	jb     c0105cbd <check_vma_overlap+0x3a>
c0105c99:	c7 44 24 0c 35 d4 10 	movl   $0xc010d435,0xc(%esp)
c0105ca0:	c0 
c0105ca1:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0105ca8:	c0 
c0105ca9:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c0105cb0:	00 
c0105cb1:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0105cb8:	e8 80 a7 ff ff       	call   c010043d <__panic>
    assert(prev->vm_end <= next->vm_start);
c0105cbd:	8b 45 08             	mov    0x8(%ebp),%eax
c0105cc0:	8b 50 08             	mov    0x8(%eax),%edx
c0105cc3:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105cc6:	8b 40 04             	mov    0x4(%eax),%eax
c0105cc9:	39 c2                	cmp    %eax,%edx
c0105ccb:	76 24                	jbe    c0105cf1 <check_vma_overlap+0x6e>
c0105ccd:	c7 44 24 0c 78 d4 10 	movl   $0xc010d478,0xc(%esp)
c0105cd4:	c0 
c0105cd5:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0105cdc:	c0 
c0105cdd:	c7 44 24 04 6c 00 00 	movl   $0x6c,0x4(%esp)
c0105ce4:	00 
c0105ce5:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0105cec:	e8 4c a7 ff ff       	call   c010043d <__panic>
    assert(next->vm_start < next->vm_end);
c0105cf1:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105cf4:	8b 50 04             	mov    0x4(%eax),%edx
c0105cf7:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105cfa:	8b 40 08             	mov    0x8(%eax),%eax
c0105cfd:	39 c2                	cmp    %eax,%edx
c0105cff:	72 24                	jb     c0105d25 <check_vma_overlap+0xa2>
c0105d01:	c7 44 24 0c 97 d4 10 	movl   $0xc010d497,0xc(%esp)
c0105d08:	c0 
c0105d09:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0105d10:	c0 
c0105d11:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c0105d18:	00 
c0105d19:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0105d20:	e8 18 a7 ff ff       	call   c010043d <__panic>
}
c0105d25:	90                   	nop
c0105d26:	c9                   	leave  
c0105d27:	c3                   	ret    

c0105d28 <insert_vma_struct>:


// insert_vma_struct -insert vma in mm's list link
void
insert_vma_struct(struct mm_struct *mm, struct vma_struct *vma) {
c0105d28:	f3 0f 1e fb          	endbr32 
c0105d2c:	55                   	push   %ebp
c0105d2d:	89 e5                	mov    %esp,%ebp
c0105d2f:	83 ec 48             	sub    $0x48,%esp
    assert(vma->vm_start < vma->vm_end);
c0105d32:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105d35:	8b 50 04             	mov    0x4(%eax),%edx
c0105d38:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105d3b:	8b 40 08             	mov    0x8(%eax),%eax
c0105d3e:	39 c2                	cmp    %eax,%edx
c0105d40:	72 24                	jb     c0105d66 <insert_vma_struct+0x3e>
c0105d42:	c7 44 24 0c b5 d4 10 	movl   $0xc010d4b5,0xc(%esp)
c0105d49:	c0 
c0105d4a:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0105d51:	c0 
c0105d52:	c7 44 24 04 74 00 00 	movl   $0x74,0x4(%esp)
c0105d59:	00 
c0105d5a:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0105d61:	e8 d7 a6 ff ff       	call   c010043d <__panic>
    list_entry_t *list = &(mm->mmap_list);
c0105d66:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d69:	89 45 ec             	mov    %eax,-0x14(%ebp)
    list_entry_t *le_prev = list, *le_next;
c0105d6c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105d6f:	89 45 f4             	mov    %eax,-0xc(%ebp)

        list_entry_t *le = list;
c0105d72:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105d75:	89 45 f0             	mov    %eax,-0x10(%ebp)
        while ((le = list_next(le)) != list) {
c0105d78:	eb 1f                	jmp    c0105d99 <insert_vma_struct+0x71>
            struct vma_struct *mmap_prev = le2vma(le, list_link);
c0105d7a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d7d:	83 e8 10             	sub    $0x10,%eax
c0105d80:	89 45 e8             	mov    %eax,-0x18(%ebp)
            if (mmap_prev->vm_start > vma->vm_start) {
c0105d83:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105d86:	8b 50 04             	mov    0x4(%eax),%edx
c0105d89:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105d8c:	8b 40 04             	mov    0x4(%eax),%eax
c0105d8f:	39 c2                	cmp    %eax,%edx
c0105d91:	77 1f                	ja     c0105db2 <insert_vma_struct+0x8a>
                break;
            }
            le_prev = le;
c0105d93:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d96:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105d99:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d9c:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0105d9f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105da2:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0105da5:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105da8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105dab:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0105dae:	75 ca                	jne    c0105d7a <insert_vma_struct+0x52>
c0105db0:	eb 01                	jmp    c0105db3 <insert_vma_struct+0x8b>
                break;
c0105db2:	90                   	nop
c0105db3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105db6:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0105db9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105dbc:	8b 40 04             	mov    0x4(%eax),%eax
        }

    le_next = list_next(le_prev);
c0105dbf:	89 45 e4             	mov    %eax,-0x1c(%ebp)

    /* check overlap */
    if (le_prev != list) {
c0105dc2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dc5:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0105dc8:	74 15                	je     c0105ddf <insert_vma_struct+0xb7>
        check_vma_overlap(le2vma(le_prev, list_link), vma);
c0105dca:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dcd:	8d 50 f0             	lea    -0x10(%eax),%edx
c0105dd0:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105dd3:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105dd7:	89 14 24             	mov    %edx,(%esp)
c0105dda:	e8 a4 fe ff ff       	call   c0105c83 <check_vma_overlap>
    }
    if (le_next != list) {
c0105ddf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105de2:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0105de5:	74 15                	je     c0105dfc <insert_vma_struct+0xd4>
        check_vma_overlap(vma, le2vma(le_next, list_link));
c0105de7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105dea:	83 e8 10             	sub    $0x10,%eax
c0105ded:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105df1:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105df4:	89 04 24             	mov    %eax,(%esp)
c0105df7:	e8 87 fe ff ff       	call   c0105c83 <check_vma_overlap>
    }

    vma->vm_mm = mm;
c0105dfc:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105dff:	8b 55 08             	mov    0x8(%ebp),%edx
c0105e02:	89 10                	mov    %edx,(%eax)
    list_add_after(le_prev, &(vma->list_link));
c0105e04:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105e07:	8d 50 10             	lea    0x10(%eax),%edx
c0105e0a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105e0d:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0105e10:	89 55 d4             	mov    %edx,-0x2c(%ebp)
    __list_add(elm, listelm, listelm->next);
c0105e13:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0105e16:	8b 40 04             	mov    0x4(%eax),%eax
c0105e19:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0105e1c:	89 55 d0             	mov    %edx,-0x30(%ebp)
c0105e1f:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0105e22:	89 55 cc             	mov    %edx,-0x34(%ebp)
c0105e25:	89 45 c8             	mov    %eax,-0x38(%ebp)
    prev->next = next->prev = elm;
c0105e28:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0105e2b:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0105e2e:	89 10                	mov    %edx,(%eax)
c0105e30:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0105e33:	8b 10                	mov    (%eax),%edx
c0105e35:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0105e38:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0105e3b:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0105e3e:	8b 55 c8             	mov    -0x38(%ebp),%edx
c0105e41:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0105e44:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0105e47:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0105e4a:	89 10                	mov    %edx,(%eax)
}
c0105e4c:	90                   	nop
}
c0105e4d:	90                   	nop

    mm->map_count ++;
c0105e4e:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e51:	8b 40 10             	mov    0x10(%eax),%eax
c0105e54:	8d 50 01             	lea    0x1(%eax),%edx
c0105e57:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e5a:	89 50 10             	mov    %edx,0x10(%eax)
}
c0105e5d:	90                   	nop
c0105e5e:	c9                   	leave  
c0105e5f:	c3                   	ret    

c0105e60 <mm_destroy>:

// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {
c0105e60:	f3 0f 1e fb          	endbr32 
c0105e64:	55                   	push   %ebp
c0105e65:	89 e5                	mov    %esp,%ebp
c0105e67:	83 ec 38             	sub    $0x38,%esp
    assert(mm_count(mm) == 0);
c0105e6a:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e6d:	89 04 24             	mov    %eax,(%esp)
c0105e70:	e8 05 fc ff ff       	call   c0105a7a <mm_count>
c0105e75:	85 c0                	test   %eax,%eax
c0105e77:	74 24                	je     c0105e9d <mm_destroy+0x3d>
c0105e79:	c7 44 24 0c d1 d4 10 	movl   $0xc010d4d1,0xc(%esp)
c0105e80:	c0 
c0105e81:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0105e88:	c0 
c0105e89:	c7 44 24 04 94 00 00 	movl   $0x94,0x4(%esp)
c0105e90:	00 
c0105e91:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0105e98:	e8 a0 a5 ff ff       	call   c010043d <__panic>

    list_entry_t *list = &(mm->mmap_list), *le;
c0105e9d:	8b 45 08             	mov    0x8(%ebp),%eax
c0105ea0:	89 45 f4             	mov    %eax,-0xc(%ebp)
    while ((le = list_next(list)) != list) {
c0105ea3:	eb 38                	jmp    c0105edd <mm_destroy+0x7d>
c0105ea5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105ea8:	89 45 ec             	mov    %eax,-0x14(%ebp)
    __list_del(listelm->prev, listelm->next);
c0105eab:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105eae:	8b 40 04             	mov    0x4(%eax),%eax
c0105eb1:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0105eb4:	8b 12                	mov    (%edx),%edx
c0105eb6:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0105eb9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    prev->next = next;
c0105ebc:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105ebf:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0105ec2:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0105ec5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105ec8:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0105ecb:	89 10                	mov    %edx,(%eax)
}
c0105ecd:	90                   	nop
}
c0105ece:	90                   	nop
        list_del(le);
        kfree(le2vma(le, list_link));  //kfree vma        
c0105ecf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105ed2:	83 e8 10             	sub    $0x10,%eax
c0105ed5:	89 04 24             	mov    %eax,(%esp)
c0105ed8:	e8 4b 14 00 00       	call   c0107328 <kfree>
c0105edd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105ee0:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return listelm->next;
c0105ee3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105ee6:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(list)) != list) {
c0105ee9:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105eec:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105eef:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0105ef2:	75 b1                	jne    c0105ea5 <mm_destroy+0x45>
    }
    kfree(mm); //kfree mm
c0105ef4:	8b 45 08             	mov    0x8(%ebp),%eax
c0105ef7:	89 04 24             	mov    %eax,(%esp)
c0105efa:	e8 29 14 00 00       	call   c0107328 <kfree>
    mm=NULL;
c0105eff:	c7 45 08 00 00 00 00 	movl   $0x0,0x8(%ebp)
}
c0105f06:	90                   	nop
c0105f07:	c9                   	leave  
c0105f08:	c3                   	ret    

c0105f09 <mm_map>:

int
mm_map(struct mm_struct *mm, uintptr_t addr, size_t len, uint32_t vm_flags,
       struct vma_struct **vma_store) {
c0105f09:	f3 0f 1e fb          	endbr32 
c0105f0d:	55                   	push   %ebp
c0105f0e:	89 e5                	mov    %esp,%ebp
c0105f10:	83 ec 38             	sub    $0x38,%esp
    uintptr_t start = ROUNDDOWN(addr, PGSIZE), end = ROUNDUP(addr + len, PGSIZE);
c0105f13:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105f16:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105f19:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105f1c:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105f21:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0105f24:	c7 45 e8 00 10 00 00 	movl   $0x1000,-0x18(%ebp)
c0105f2b:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105f2e:	8b 45 10             	mov    0x10(%ebp),%eax
c0105f31:	01 c2                	add    %eax,%edx
c0105f33:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105f36:	01 d0                	add    %edx,%eax
c0105f38:	48                   	dec    %eax
c0105f39:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0105f3c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105f3f:	ba 00 00 00 00       	mov    $0x0,%edx
c0105f44:	f7 75 e8             	divl   -0x18(%ebp)
c0105f47:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105f4a:	29 d0                	sub    %edx,%eax
c0105f4c:	89 45 e0             	mov    %eax,-0x20(%ebp)
    if (!USER_ACCESS(start, end)) {
c0105f4f:	81 7d ec ff ff 1f 00 	cmpl   $0x1fffff,-0x14(%ebp)
c0105f56:	76 11                	jbe    c0105f69 <mm_map+0x60>
c0105f58:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105f5b:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0105f5e:	73 09                	jae    c0105f69 <mm_map+0x60>
c0105f60:	81 7d e0 00 00 00 b0 	cmpl   $0xb0000000,-0x20(%ebp)
c0105f67:	76 0a                	jbe    c0105f73 <mm_map+0x6a>
        return -E_INVAL;
c0105f69:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c0105f6e:	e9 b0 00 00 00       	jmp    c0106023 <mm_map+0x11a>
    }

    assert(mm != NULL);
c0105f73:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0105f77:	75 24                	jne    c0105f9d <mm_map+0x94>
c0105f79:	c7 44 24 0c e3 d4 10 	movl   $0xc010d4e3,0xc(%esp)
c0105f80:	c0 
c0105f81:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0105f88:	c0 
c0105f89:	c7 44 24 04 a7 00 00 	movl   $0xa7,0x4(%esp)
c0105f90:	00 
c0105f91:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0105f98:	e8 a0 a4 ff ff       	call   c010043d <__panic>

    int ret = -E_INVAL;
c0105f9d:	c7 45 f4 fd ff ff ff 	movl   $0xfffffffd,-0xc(%ebp)

    struct vma_struct *vma;
    if ((vma = find_vma(mm, start)) != NULL && end > vma->vm_start) {
c0105fa4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105fa7:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105fab:	8b 45 08             	mov    0x8(%ebp),%eax
c0105fae:	89 04 24             	mov    %eax,(%esp)
c0105fb1:	e8 18 fc ff ff       	call   c0105bce <find_vma>
c0105fb6:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0105fb9:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0105fbd:	74 0b                	je     c0105fca <mm_map+0xc1>
c0105fbf:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105fc2:	8b 40 04             	mov    0x4(%eax),%eax
c0105fc5:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0105fc8:	77 52                	ja     c010601c <mm_map+0x113>
        goto out;
    }
    ret = -E_NO_MEM;
c0105fca:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)

    if ((vma = vma_create(start, end, vm_flags)) == NULL) {
c0105fd1:	8b 45 14             	mov    0x14(%ebp),%eax
c0105fd4:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105fd8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105fdb:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105fdf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105fe2:	89 04 24             	mov    %eax,(%esp)
c0105fe5:	e8 a5 fb ff ff       	call   c0105b8f <vma_create>
c0105fea:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0105fed:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0105ff1:	74 2c                	je     c010601f <mm_map+0x116>
        goto out;
    }
    insert_vma_struct(mm, vma);
c0105ff3:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105ff6:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105ffa:	8b 45 08             	mov    0x8(%ebp),%eax
c0105ffd:	89 04 24             	mov    %eax,(%esp)
c0106000:	e8 23 fd ff ff       	call   c0105d28 <insert_vma_struct>
    if (vma_store != NULL) {
c0106005:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c0106009:	74 08                	je     c0106013 <mm_map+0x10a>
        *vma_store = vma;
c010600b:	8b 45 18             	mov    0x18(%ebp),%eax
c010600e:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106011:	89 10                	mov    %edx,(%eax)
    }
    ret = 0;
c0106013:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c010601a:	eb 04                	jmp    c0106020 <mm_map+0x117>
        goto out;
c010601c:	90                   	nop
c010601d:	eb 01                	jmp    c0106020 <mm_map+0x117>
        goto out;
c010601f:	90                   	nop

out:
    return ret;
c0106020:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106023:	c9                   	leave  
c0106024:	c3                   	ret    

c0106025 <dup_mmap>:

int
dup_mmap(struct mm_struct *to, struct mm_struct *from) {
c0106025:	f3 0f 1e fb          	endbr32 
c0106029:	55                   	push   %ebp
c010602a:	89 e5                	mov    %esp,%ebp
c010602c:	56                   	push   %esi
c010602d:	53                   	push   %ebx
c010602e:	83 ec 40             	sub    $0x40,%esp
    assert(to != NULL && from != NULL);
c0106031:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0106035:	74 06                	je     c010603d <dup_mmap+0x18>
c0106037:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010603b:	75 24                	jne    c0106061 <dup_mmap+0x3c>
c010603d:	c7 44 24 0c ee d4 10 	movl   $0xc010d4ee,0xc(%esp)
c0106044:	c0 
c0106045:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c010604c:	c0 
c010604d:	c7 44 24 04 c0 00 00 	movl   $0xc0,0x4(%esp)
c0106054:	00 
c0106055:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010605c:	e8 dc a3 ff ff       	call   c010043d <__panic>
    list_entry_t *list = &(from->mmap_list), *le = list;
c0106061:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106064:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106067:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010606a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    while ((le = list_prev(le)) != list) {
c010606d:	e9 92 00 00 00       	jmp    c0106104 <dup_mmap+0xdf>
        struct vma_struct *vma, *nvma;
        vma = le2vma(le, list_link);
c0106072:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106075:	83 e8 10             	sub    $0x10,%eax
c0106078:	89 45 ec             	mov    %eax,-0x14(%ebp)
        nvma = vma_create(vma->vm_start, vma->vm_end, vma->vm_flags);
c010607b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010607e:	8b 48 0c             	mov    0xc(%eax),%ecx
c0106081:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106084:	8b 50 08             	mov    0x8(%eax),%edx
c0106087:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010608a:	8b 40 04             	mov    0x4(%eax),%eax
c010608d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0106091:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106095:	89 04 24             	mov    %eax,(%esp)
c0106098:	e8 f2 fa ff ff       	call   c0105b8f <vma_create>
c010609d:	89 45 e8             	mov    %eax,-0x18(%ebp)
        if (nvma == NULL) {
c01060a0:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01060a4:	75 07                	jne    c01060ad <dup_mmap+0x88>
            return -E_NO_MEM;
c01060a6:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c01060ab:	eb 76                	jmp    c0106123 <dup_mmap+0xfe>
        }

        insert_vma_struct(to, nvma);
c01060ad:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01060b0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01060b4:	8b 45 08             	mov    0x8(%ebp),%eax
c01060b7:	89 04 24             	mov    %eax,(%esp)
c01060ba:	e8 69 fc ff ff       	call   c0105d28 <insert_vma_struct>

        bool share = 0;
c01060bf:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
        if (copy_range(to->pgdir, from->pgdir, vma->vm_start, vma->vm_end, share) != 0) {
c01060c6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01060c9:	8b 58 08             	mov    0x8(%eax),%ebx
c01060cc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01060cf:	8b 48 04             	mov    0x4(%eax),%ecx
c01060d2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01060d5:	8b 50 0c             	mov    0xc(%eax),%edx
c01060d8:	8b 45 08             	mov    0x8(%ebp),%eax
c01060db:	8b 40 0c             	mov    0xc(%eax),%eax
c01060de:	8b 75 e4             	mov    -0x1c(%ebp),%esi
c01060e1:	89 74 24 10          	mov    %esi,0x10(%esp)
c01060e5:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01060e9:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01060ed:	89 54 24 04          	mov    %edx,0x4(%esp)
c01060f1:	89 04 24             	mov    %eax,(%esp)
c01060f4:	e8 52 e3 ff ff       	call   c010444b <copy_range>
c01060f9:	85 c0                	test   %eax,%eax
c01060fb:	74 07                	je     c0106104 <dup_mmap+0xdf>
            return -E_NO_MEM;
c01060fd:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c0106102:	eb 1f                	jmp    c0106123 <dup_mmap+0xfe>
c0106104:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106107:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return listelm->prev;
c010610a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010610d:	8b 00                	mov    (%eax),%eax
    while ((le = list_prev(le)) != list) {
c010610f:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106112:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106115:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0106118:	0f 85 54 ff ff ff    	jne    c0106072 <dup_mmap+0x4d>
        }
    }
    return 0;
c010611e:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106123:	83 c4 40             	add    $0x40,%esp
c0106126:	5b                   	pop    %ebx
c0106127:	5e                   	pop    %esi
c0106128:	5d                   	pop    %ebp
c0106129:	c3                   	ret    

c010612a <exit_mmap>:

void
exit_mmap(struct mm_struct *mm) {
c010612a:	f3 0f 1e fb          	endbr32 
c010612e:	55                   	push   %ebp
c010612f:	89 e5                	mov    %esp,%ebp
c0106131:	83 ec 38             	sub    $0x38,%esp
    assert(mm != NULL && mm_count(mm) == 0);
c0106134:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0106138:	74 0f                	je     c0106149 <exit_mmap+0x1f>
c010613a:	8b 45 08             	mov    0x8(%ebp),%eax
c010613d:	89 04 24             	mov    %eax,(%esp)
c0106140:	e8 35 f9 ff ff       	call   c0105a7a <mm_count>
c0106145:	85 c0                	test   %eax,%eax
c0106147:	74 24                	je     c010616d <exit_mmap+0x43>
c0106149:	c7 44 24 0c 0c d5 10 	movl   $0xc010d50c,0xc(%esp)
c0106150:	c0 
c0106151:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0106158:	c0 
c0106159:	c7 44 24 04 d6 00 00 	movl   $0xd6,0x4(%esp)
c0106160:	00 
c0106161:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0106168:	e8 d0 a2 ff ff       	call   c010043d <__panic>
    pde_t *pgdir = mm->pgdir;
c010616d:	8b 45 08             	mov    0x8(%ebp),%eax
c0106170:	8b 40 0c             	mov    0xc(%eax),%eax
c0106173:	89 45 f0             	mov    %eax,-0x10(%ebp)
    list_entry_t *list = &(mm->mmap_list), *le = list;
c0106176:	8b 45 08             	mov    0x8(%ebp),%eax
c0106179:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010617c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010617f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    while ((le = list_next(le)) != list) {
c0106182:	eb 28                	jmp    c01061ac <exit_mmap+0x82>
        struct vma_struct *vma = le2vma(le, list_link);
c0106184:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106187:	83 e8 10             	sub    $0x10,%eax
c010618a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        unmap_range(pgdir, vma->vm_start, vma->vm_end);
c010618d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106190:	8b 50 08             	mov    0x8(%eax),%edx
c0106193:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106196:	8b 40 04             	mov    0x4(%eax),%eax
c0106199:	89 54 24 08          	mov    %edx,0x8(%esp)
c010619d:	89 44 24 04          	mov    %eax,0x4(%esp)
c01061a1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01061a4:	89 04 24             	mov    %eax,(%esp)
c01061a7:	e8 9a e0 ff ff       	call   c0104246 <unmap_range>
c01061ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01061af:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return listelm->next;
c01061b2:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01061b5:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != list) {
c01061b8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01061bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01061be:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01061c1:	75 c1                	jne    c0106184 <exit_mmap+0x5a>
    }
    while ((le = list_next(le)) != list) {
c01061c3:	eb 28                	jmp    c01061ed <exit_mmap+0xc3>
        struct vma_struct *vma = le2vma(le, list_link);
c01061c5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01061c8:	83 e8 10             	sub    $0x10,%eax
c01061cb:	89 45 e8             	mov    %eax,-0x18(%ebp)
        exit_range(pgdir, vma->vm_start, vma->vm_end);
c01061ce:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01061d1:	8b 50 08             	mov    0x8(%eax),%edx
c01061d4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01061d7:	8b 40 04             	mov    0x4(%eax),%eax
c01061da:	89 54 24 08          	mov    %edx,0x8(%esp)
c01061de:	89 44 24 04          	mov    %eax,0x4(%esp)
c01061e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01061e5:	89 04 24             	mov    %eax,(%esp)
c01061e8:	e8 52 e1 ff ff       	call   c010433f <exit_range>
c01061ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01061f0:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01061f3:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01061f6:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != list) {
c01061f9:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01061fc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01061ff:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0106202:	75 c1                	jne    c01061c5 <exit_mmap+0x9b>
    }
}
c0106204:	90                   	nop
c0106205:	90                   	nop
c0106206:	c9                   	leave  
c0106207:	c3                   	ret    

c0106208 <copy_from_user>:

bool
copy_from_user(struct mm_struct *mm, void *dst, const void *src, size_t len, bool writable) {
c0106208:	f3 0f 1e fb          	endbr32 
c010620c:	55                   	push   %ebp
c010620d:	89 e5                	mov    %esp,%ebp
c010620f:	83 ec 18             	sub    $0x18,%esp
    if (!user_mem_check(mm, (uintptr_t)src, len, writable)) {
c0106212:	8b 45 10             	mov    0x10(%ebp),%eax
c0106215:	8b 55 18             	mov    0x18(%ebp),%edx
c0106218:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010621c:	8b 55 14             	mov    0x14(%ebp),%edx
c010621f:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106223:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106227:	8b 45 08             	mov    0x8(%ebp),%eax
c010622a:	89 04 24             	mov    %eax,(%esp)
c010622d:	e8 90 09 00 00       	call   c0106bc2 <user_mem_check>
c0106232:	85 c0                	test   %eax,%eax
c0106234:	75 07                	jne    c010623d <copy_from_user+0x35>
        return 0;
c0106236:	b8 00 00 00 00       	mov    $0x0,%eax
c010623b:	eb 1e                	jmp    c010625b <copy_from_user+0x53>
    }
    memcpy(dst, src, len);
c010623d:	8b 45 14             	mov    0x14(%ebp),%eax
c0106240:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106244:	8b 45 10             	mov    0x10(%ebp),%eax
c0106247:	89 44 24 04          	mov    %eax,0x4(%esp)
c010624b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010624e:	89 04 24             	mov    %eax,(%esp)
c0106251:	e8 c1 56 00 00       	call   c010b917 <memcpy>
    return 1;
c0106256:	b8 01 00 00 00       	mov    $0x1,%eax
}
c010625b:	c9                   	leave  
c010625c:	c3                   	ret    

c010625d <copy_to_user>:

bool
copy_to_user(struct mm_struct *mm, void *dst, const void *src, size_t len) {
c010625d:	f3 0f 1e fb          	endbr32 
c0106261:	55                   	push   %ebp
c0106262:	89 e5                	mov    %esp,%ebp
c0106264:	83 ec 18             	sub    $0x18,%esp
    if (!user_mem_check(mm, (uintptr_t)dst, len, 1)) {
c0106267:	8b 45 0c             	mov    0xc(%ebp),%eax
c010626a:	c7 44 24 0c 01 00 00 	movl   $0x1,0xc(%esp)
c0106271:	00 
c0106272:	8b 55 14             	mov    0x14(%ebp),%edx
c0106275:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106279:	89 44 24 04          	mov    %eax,0x4(%esp)
c010627d:	8b 45 08             	mov    0x8(%ebp),%eax
c0106280:	89 04 24             	mov    %eax,(%esp)
c0106283:	e8 3a 09 00 00       	call   c0106bc2 <user_mem_check>
c0106288:	85 c0                	test   %eax,%eax
c010628a:	75 07                	jne    c0106293 <copy_to_user+0x36>
        return 0;
c010628c:	b8 00 00 00 00       	mov    $0x0,%eax
c0106291:	eb 1e                	jmp    c01062b1 <copy_to_user+0x54>
    }
    memcpy(dst, src, len);
c0106293:	8b 45 14             	mov    0x14(%ebp),%eax
c0106296:	89 44 24 08          	mov    %eax,0x8(%esp)
c010629a:	8b 45 10             	mov    0x10(%ebp),%eax
c010629d:	89 44 24 04          	mov    %eax,0x4(%esp)
c01062a1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01062a4:	89 04 24             	mov    %eax,(%esp)
c01062a7:	e8 6b 56 00 00       	call   c010b917 <memcpy>
    return 1;
c01062ac:	b8 01 00 00 00       	mov    $0x1,%eax
}
c01062b1:	c9                   	leave  
c01062b2:	c3                   	ret    

c01062b3 <vmm_init>:

// vmm_init - initialize virtual memory management
//          - now just call check_vmm to check correctness of vmm
void
vmm_init(void) {
c01062b3:	f3 0f 1e fb          	endbr32 
c01062b7:	55                   	push   %ebp
c01062b8:	89 e5                	mov    %esp,%ebp
c01062ba:	83 ec 08             	sub    $0x8,%esp
    check_vmm();
c01062bd:	e8 03 00 00 00       	call   c01062c5 <check_vmm>
}
c01062c2:	90                   	nop
c01062c3:	c9                   	leave  
c01062c4:	c3                   	ret    

c01062c5 <check_vmm>:

// check_vmm - check correctness of vmm
static void
check_vmm(void) {
c01062c5:	f3 0f 1e fb          	endbr32 
c01062c9:	55                   	push   %ebp
c01062ca:	89 e5                	mov    %esp,%ebp
c01062cc:	83 ec 28             	sub    $0x28,%esp
    size_t nr_free_pages_store = nr_free_pages();
c01062cf:	e8 47 d7 ff ff       	call   c0103a1b <nr_free_pages>
c01062d4:	89 45 f4             	mov    %eax,-0xc(%ebp)
    
    check_vma_struct();
c01062d7:	e8 14 00 00 00       	call   c01062f0 <check_vma_struct>
    check_pgfault();
c01062dc:	e8 a5 04 00 00       	call   c0106786 <check_pgfault>

    cprintf("check_vmm() succeeded.\n");
c01062e1:	c7 04 24 2c d5 10 c0 	movl   $0xc010d52c,(%esp)
c01062e8:	e8 e4 9f ff ff       	call   c01002d1 <cprintf>
}
c01062ed:	90                   	nop
c01062ee:	c9                   	leave  
c01062ef:	c3                   	ret    

c01062f0 <check_vma_struct>:

static void
check_vma_struct(void) {
c01062f0:	f3 0f 1e fb          	endbr32 
c01062f4:	55                   	push   %ebp
c01062f5:	89 e5                	mov    %esp,%ebp
c01062f7:	83 ec 68             	sub    $0x68,%esp
    size_t nr_free_pages_store = nr_free_pages();
c01062fa:	e8 1c d7 ff ff       	call   c0103a1b <nr_free_pages>
c01062ff:	89 45 ec             	mov    %eax,-0x14(%ebp)

    struct mm_struct *mm = mm_create();
c0106302:	e8 ea f7 ff ff       	call   c0105af1 <mm_create>
c0106307:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(mm != NULL);
c010630a:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010630e:	75 24                	jne    c0106334 <check_vma_struct+0x44>
c0106310:	c7 44 24 0c e3 d4 10 	movl   $0xc010d4e3,0xc(%esp)
c0106317:	c0 
c0106318:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c010631f:	c0 
c0106320:	c7 44 24 04 0c 01 00 	movl   $0x10c,0x4(%esp)
c0106327:	00 
c0106328:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010632f:	e8 09 a1 ff ff       	call   c010043d <__panic>

    int step1 = 10, step2 = step1 * 10;
c0106334:	c7 45 e4 0a 00 00 00 	movl   $0xa,-0x1c(%ebp)
c010633b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010633e:	89 d0                	mov    %edx,%eax
c0106340:	c1 e0 02             	shl    $0x2,%eax
c0106343:	01 d0                	add    %edx,%eax
c0106345:	01 c0                	add    %eax,%eax
c0106347:	89 45 e0             	mov    %eax,-0x20(%ebp)

    int i;
    for (i = step1; i >= 1; i --) {
c010634a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010634d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106350:	eb 6f                	jmp    c01063c1 <check_vma_struct+0xd1>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c0106352:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106355:	89 d0                	mov    %edx,%eax
c0106357:	c1 e0 02             	shl    $0x2,%eax
c010635a:	01 d0                	add    %edx,%eax
c010635c:	83 c0 02             	add    $0x2,%eax
c010635f:	89 c1                	mov    %eax,%ecx
c0106361:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106364:	89 d0                	mov    %edx,%eax
c0106366:	c1 e0 02             	shl    $0x2,%eax
c0106369:	01 d0                	add    %edx,%eax
c010636b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106372:	00 
c0106373:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0106377:	89 04 24             	mov    %eax,(%esp)
c010637a:	e8 10 f8 ff ff       	call   c0105b8f <vma_create>
c010637f:	89 45 bc             	mov    %eax,-0x44(%ebp)
        assert(vma != NULL);
c0106382:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0106386:	75 24                	jne    c01063ac <check_vma_struct+0xbc>
c0106388:	c7 44 24 0c 44 d5 10 	movl   $0xc010d544,0xc(%esp)
c010638f:	c0 
c0106390:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0106397:	c0 
c0106398:	c7 44 24 04 13 01 00 	movl   $0x113,0x4(%esp)
c010639f:	00 
c01063a0:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c01063a7:	e8 91 a0 ff ff       	call   c010043d <__panic>
        insert_vma_struct(mm, vma);
c01063ac:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01063af:	89 44 24 04          	mov    %eax,0x4(%esp)
c01063b3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01063b6:	89 04 24             	mov    %eax,(%esp)
c01063b9:	e8 6a f9 ff ff       	call   c0105d28 <insert_vma_struct>
    for (i = step1; i >= 1; i --) {
c01063be:	ff 4d f4             	decl   -0xc(%ebp)
c01063c1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01063c5:	7f 8b                	jg     c0106352 <check_vma_struct+0x62>
    }

    for (i = step1 + 1; i <= step2; i ++) {
c01063c7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01063ca:	40                   	inc    %eax
c01063cb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01063ce:	eb 6f                	jmp    c010643f <check_vma_struct+0x14f>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c01063d0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01063d3:	89 d0                	mov    %edx,%eax
c01063d5:	c1 e0 02             	shl    $0x2,%eax
c01063d8:	01 d0                	add    %edx,%eax
c01063da:	83 c0 02             	add    $0x2,%eax
c01063dd:	89 c1                	mov    %eax,%ecx
c01063df:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01063e2:	89 d0                	mov    %edx,%eax
c01063e4:	c1 e0 02             	shl    $0x2,%eax
c01063e7:	01 d0                	add    %edx,%eax
c01063e9:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01063f0:	00 
c01063f1:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c01063f5:	89 04 24             	mov    %eax,(%esp)
c01063f8:	e8 92 f7 ff ff       	call   c0105b8f <vma_create>
c01063fd:	89 45 c0             	mov    %eax,-0x40(%ebp)
        assert(vma != NULL);
c0106400:	83 7d c0 00          	cmpl   $0x0,-0x40(%ebp)
c0106404:	75 24                	jne    c010642a <check_vma_struct+0x13a>
c0106406:	c7 44 24 0c 44 d5 10 	movl   $0xc010d544,0xc(%esp)
c010640d:	c0 
c010640e:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0106415:	c0 
c0106416:	c7 44 24 04 19 01 00 	movl   $0x119,0x4(%esp)
c010641d:	00 
c010641e:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0106425:	e8 13 a0 ff ff       	call   c010043d <__panic>
        insert_vma_struct(mm, vma);
c010642a:	8b 45 c0             	mov    -0x40(%ebp),%eax
c010642d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106431:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106434:	89 04 24             	mov    %eax,(%esp)
c0106437:	e8 ec f8 ff ff       	call   c0105d28 <insert_vma_struct>
    for (i = step1 + 1; i <= step2; i ++) {
c010643c:	ff 45 f4             	incl   -0xc(%ebp)
c010643f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106442:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0106445:	7e 89                	jle    c01063d0 <check_vma_struct+0xe0>
    }

    list_entry_t *le = list_next(&(mm->mmap_list));
c0106447:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010644a:	89 45 b8             	mov    %eax,-0x48(%ebp)
c010644d:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0106450:	8b 40 04             	mov    0x4(%eax),%eax
c0106453:	89 45 f0             	mov    %eax,-0x10(%ebp)

    for (i = 1; i <= step2; i ++) {
c0106456:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c010645d:	e9 96 00 00 00       	jmp    c01064f8 <check_vma_struct+0x208>
        assert(le != &(mm->mmap_list));
c0106462:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106465:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0106468:	75 24                	jne    c010648e <check_vma_struct+0x19e>
c010646a:	c7 44 24 0c 50 d5 10 	movl   $0xc010d550,0xc(%esp)
c0106471:	c0 
c0106472:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0106479:	c0 
c010647a:	c7 44 24 04 20 01 00 	movl   $0x120,0x4(%esp)
c0106481:	00 
c0106482:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0106489:	e8 af 9f ff ff       	call   c010043d <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
c010648e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106491:	83 e8 10             	sub    $0x10,%eax
c0106494:	89 45 c4             	mov    %eax,-0x3c(%ebp)
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
c0106497:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010649a:	8b 48 04             	mov    0x4(%eax),%ecx
c010649d:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01064a0:	89 d0                	mov    %edx,%eax
c01064a2:	c1 e0 02             	shl    $0x2,%eax
c01064a5:	01 d0                	add    %edx,%eax
c01064a7:	39 c1                	cmp    %eax,%ecx
c01064a9:	75 17                	jne    c01064c2 <check_vma_struct+0x1d2>
c01064ab:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01064ae:	8b 48 08             	mov    0x8(%eax),%ecx
c01064b1:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01064b4:	89 d0                	mov    %edx,%eax
c01064b6:	c1 e0 02             	shl    $0x2,%eax
c01064b9:	01 d0                	add    %edx,%eax
c01064bb:	83 c0 02             	add    $0x2,%eax
c01064be:	39 c1                	cmp    %eax,%ecx
c01064c0:	74 24                	je     c01064e6 <check_vma_struct+0x1f6>
c01064c2:	c7 44 24 0c 68 d5 10 	movl   $0xc010d568,0xc(%esp)
c01064c9:	c0 
c01064ca:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c01064d1:	c0 
c01064d2:	c7 44 24 04 22 01 00 	movl   $0x122,0x4(%esp)
c01064d9:	00 
c01064da:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c01064e1:	e8 57 9f ff ff       	call   c010043d <__panic>
c01064e6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01064e9:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c01064ec:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01064ef:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c01064f2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    for (i = 1; i <= step2; i ++) {
c01064f5:	ff 45 f4             	incl   -0xc(%ebp)
c01064f8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01064fb:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c01064fe:	0f 8e 5e ff ff ff    	jle    c0106462 <check_vma_struct+0x172>
    }

    for (i = 5; i <= 5 * step2; i +=5) {
c0106504:	c7 45 f4 05 00 00 00 	movl   $0x5,-0xc(%ebp)
c010650b:	e9 cb 01 00 00       	jmp    c01066db <check_vma_struct+0x3eb>
        struct vma_struct *vma1 = find_vma(mm, i);
c0106510:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106513:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106517:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010651a:	89 04 24             	mov    %eax,(%esp)
c010651d:	e8 ac f6 ff ff       	call   c0105bce <find_vma>
c0106522:	89 45 d8             	mov    %eax,-0x28(%ebp)
        assert(vma1 != NULL);
c0106525:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c0106529:	75 24                	jne    c010654f <check_vma_struct+0x25f>
c010652b:	c7 44 24 0c 9d d5 10 	movl   $0xc010d59d,0xc(%esp)
c0106532:	c0 
c0106533:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c010653a:	c0 
c010653b:	c7 44 24 04 28 01 00 	movl   $0x128,0x4(%esp)
c0106542:	00 
c0106543:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010654a:	e8 ee 9e ff ff       	call   c010043d <__panic>
        struct vma_struct *vma2 = find_vma(mm, i+1);
c010654f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106552:	40                   	inc    %eax
c0106553:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106557:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010655a:	89 04 24             	mov    %eax,(%esp)
c010655d:	e8 6c f6 ff ff       	call   c0105bce <find_vma>
c0106562:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(vma2 != NULL);
c0106565:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
c0106569:	75 24                	jne    c010658f <check_vma_struct+0x29f>
c010656b:	c7 44 24 0c aa d5 10 	movl   $0xc010d5aa,0xc(%esp)
c0106572:	c0 
c0106573:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c010657a:	c0 
c010657b:	c7 44 24 04 2a 01 00 	movl   $0x12a,0x4(%esp)
c0106582:	00 
c0106583:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010658a:	e8 ae 9e ff ff       	call   c010043d <__panic>
        struct vma_struct *vma3 = find_vma(mm, i+2);
c010658f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106592:	83 c0 02             	add    $0x2,%eax
c0106595:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106599:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010659c:	89 04 24             	mov    %eax,(%esp)
c010659f:	e8 2a f6 ff ff       	call   c0105bce <find_vma>
c01065a4:	89 45 d0             	mov    %eax,-0x30(%ebp)
        assert(vma3 == NULL);
c01065a7:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c01065ab:	74 24                	je     c01065d1 <check_vma_struct+0x2e1>
c01065ad:	c7 44 24 0c b7 d5 10 	movl   $0xc010d5b7,0xc(%esp)
c01065b4:	c0 
c01065b5:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c01065bc:	c0 
c01065bd:	c7 44 24 04 2c 01 00 	movl   $0x12c,0x4(%esp)
c01065c4:	00 
c01065c5:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c01065cc:	e8 6c 9e ff ff       	call   c010043d <__panic>
        struct vma_struct *vma4 = find_vma(mm, i+3);
c01065d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01065d4:	83 c0 03             	add    $0x3,%eax
c01065d7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01065db:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01065de:	89 04 24             	mov    %eax,(%esp)
c01065e1:	e8 e8 f5 ff ff       	call   c0105bce <find_vma>
c01065e6:	89 45 cc             	mov    %eax,-0x34(%ebp)
        assert(vma4 == NULL);
c01065e9:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c01065ed:	74 24                	je     c0106613 <check_vma_struct+0x323>
c01065ef:	c7 44 24 0c c4 d5 10 	movl   $0xc010d5c4,0xc(%esp)
c01065f6:	c0 
c01065f7:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c01065fe:	c0 
c01065ff:	c7 44 24 04 2e 01 00 	movl   $0x12e,0x4(%esp)
c0106606:	00 
c0106607:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010660e:	e8 2a 9e ff ff       	call   c010043d <__panic>
        struct vma_struct *vma5 = find_vma(mm, i+4);
c0106613:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106616:	83 c0 04             	add    $0x4,%eax
c0106619:	89 44 24 04          	mov    %eax,0x4(%esp)
c010661d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106620:	89 04 24             	mov    %eax,(%esp)
c0106623:	e8 a6 f5 ff ff       	call   c0105bce <find_vma>
c0106628:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(vma5 == NULL);
c010662b:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c010662f:	74 24                	je     c0106655 <check_vma_struct+0x365>
c0106631:	c7 44 24 0c d1 d5 10 	movl   $0xc010d5d1,0xc(%esp)
c0106638:	c0 
c0106639:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0106640:	c0 
c0106641:	c7 44 24 04 30 01 00 	movl   $0x130,0x4(%esp)
c0106648:	00 
c0106649:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0106650:	e8 e8 9d ff ff       	call   c010043d <__panic>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
c0106655:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106658:	8b 50 04             	mov    0x4(%eax),%edx
c010665b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010665e:	39 c2                	cmp    %eax,%edx
c0106660:	75 10                	jne    c0106672 <check_vma_struct+0x382>
c0106662:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106665:	8b 40 08             	mov    0x8(%eax),%eax
c0106668:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010666b:	83 c2 02             	add    $0x2,%edx
c010666e:	39 d0                	cmp    %edx,%eax
c0106670:	74 24                	je     c0106696 <check_vma_struct+0x3a6>
c0106672:	c7 44 24 0c e0 d5 10 	movl   $0xc010d5e0,0xc(%esp)
c0106679:	c0 
c010667a:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0106681:	c0 
c0106682:	c7 44 24 04 32 01 00 	movl   $0x132,0x4(%esp)
c0106689:	00 
c010668a:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0106691:	e8 a7 9d ff ff       	call   c010043d <__panic>
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
c0106696:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0106699:	8b 50 04             	mov    0x4(%eax),%edx
c010669c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010669f:	39 c2                	cmp    %eax,%edx
c01066a1:	75 10                	jne    c01066b3 <check_vma_struct+0x3c3>
c01066a3:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01066a6:	8b 40 08             	mov    0x8(%eax),%eax
c01066a9:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01066ac:	83 c2 02             	add    $0x2,%edx
c01066af:	39 d0                	cmp    %edx,%eax
c01066b1:	74 24                	je     c01066d7 <check_vma_struct+0x3e7>
c01066b3:	c7 44 24 0c 10 d6 10 	movl   $0xc010d610,0xc(%esp)
c01066ba:	c0 
c01066bb:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c01066c2:	c0 
c01066c3:	c7 44 24 04 33 01 00 	movl   $0x133,0x4(%esp)
c01066ca:	00 
c01066cb:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c01066d2:	e8 66 9d ff ff       	call   c010043d <__panic>
    for (i = 5; i <= 5 * step2; i +=5) {
c01066d7:	83 45 f4 05          	addl   $0x5,-0xc(%ebp)
c01066db:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01066de:	89 d0                	mov    %edx,%eax
c01066e0:	c1 e0 02             	shl    $0x2,%eax
c01066e3:	01 d0                	add    %edx,%eax
c01066e5:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c01066e8:	0f 8e 22 fe ff ff    	jle    c0106510 <check_vma_struct+0x220>
    }

    for (i =4; i>=0; i--) {
c01066ee:	c7 45 f4 04 00 00 00 	movl   $0x4,-0xc(%ebp)
c01066f5:	eb 6f                	jmp    c0106766 <check_vma_struct+0x476>
        struct vma_struct *vma_below_5= find_vma(mm,i);
c01066f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01066fa:	89 44 24 04          	mov    %eax,0x4(%esp)
c01066fe:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106701:	89 04 24             	mov    %eax,(%esp)
c0106704:	e8 c5 f4 ff ff       	call   c0105bce <find_vma>
c0106709:	89 45 dc             	mov    %eax,-0x24(%ebp)
        if (vma_below_5 != NULL ) {
c010670c:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0106710:	74 27                	je     c0106739 <check_vma_struct+0x449>
           cprintf("vma_below_5: i %x, start %x, end %x\n",i, vma_below_5->vm_start, vma_below_5->vm_end); 
c0106712:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106715:	8b 50 08             	mov    0x8(%eax),%edx
c0106718:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010671b:	8b 40 04             	mov    0x4(%eax),%eax
c010671e:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0106722:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106726:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106729:	89 44 24 04          	mov    %eax,0x4(%esp)
c010672d:	c7 04 24 40 d6 10 c0 	movl   $0xc010d640,(%esp)
c0106734:	e8 98 9b ff ff       	call   c01002d1 <cprintf>
        }
        assert(vma_below_5 == NULL);
c0106739:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c010673d:	74 24                	je     c0106763 <check_vma_struct+0x473>
c010673f:	c7 44 24 0c 65 d6 10 	movl   $0xc010d665,0xc(%esp)
c0106746:	c0 
c0106747:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c010674e:	c0 
c010674f:	c7 44 24 04 3b 01 00 	movl   $0x13b,0x4(%esp)
c0106756:	00 
c0106757:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010675e:	e8 da 9c ff ff       	call   c010043d <__panic>
    for (i =4; i>=0; i--) {
c0106763:	ff 4d f4             	decl   -0xc(%ebp)
c0106766:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010676a:	79 8b                	jns    c01066f7 <check_vma_struct+0x407>
    }

    mm_destroy(mm);
c010676c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010676f:	89 04 24             	mov    %eax,(%esp)
c0106772:	e8 e9 f6 ff ff       	call   c0105e60 <mm_destroy>

    cprintf("check_vma_struct() succeeded!\n");
c0106777:	c7 04 24 7c d6 10 c0 	movl   $0xc010d67c,(%esp)
c010677e:	e8 4e 9b ff ff       	call   c01002d1 <cprintf>
}
c0106783:	90                   	nop
c0106784:	c9                   	leave  
c0106785:	c3                   	ret    

c0106786 <check_pgfault>:

struct mm_struct *check_mm_struct;

// check_pgfault - check correctness of pgfault handler
static void
check_pgfault(void) {
c0106786:	f3 0f 1e fb          	endbr32 
c010678a:	55                   	push   %ebp
c010678b:	89 e5                	mov    %esp,%ebp
c010678d:	83 ec 38             	sub    $0x38,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0106790:	e8 86 d2 ff ff       	call   c0103a1b <nr_free_pages>
c0106795:	89 45 ec             	mov    %eax,-0x14(%ebp)

    check_mm_struct = mm_create();
c0106798:	e8 54 f3 ff ff       	call   c0105af1 <mm_create>
c010679d:	a3 6c 40 1b c0       	mov    %eax,0xc01b406c
    assert(check_mm_struct != NULL);
c01067a2:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c01067a7:	85 c0                	test   %eax,%eax
c01067a9:	75 24                	jne    c01067cf <check_pgfault+0x49>
c01067ab:	c7 44 24 0c 9b d6 10 	movl   $0xc010d69b,0xc(%esp)
c01067b2:	c0 
c01067b3:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c01067ba:	c0 
c01067bb:	c7 44 24 04 4b 01 00 	movl   $0x14b,0x4(%esp)
c01067c2:	00 
c01067c3:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c01067ca:	e8 6e 9c ff ff       	call   c010043d <__panic>

    struct mm_struct *mm = check_mm_struct;
c01067cf:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c01067d4:	89 45 e8             	mov    %eax,-0x18(%ebp)
    pde_t *pgdir = mm->pgdir = boot_pgdir;
c01067d7:	8b 15 e0 e9 12 c0    	mov    0xc012e9e0,%edx
c01067dd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01067e0:	89 50 0c             	mov    %edx,0xc(%eax)
c01067e3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01067e6:	8b 40 0c             	mov    0xc(%eax),%eax
c01067e9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(pgdir[0] == 0);
c01067ec:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01067ef:	8b 00                	mov    (%eax),%eax
c01067f1:	85 c0                	test   %eax,%eax
c01067f3:	74 24                	je     c0106819 <check_pgfault+0x93>
c01067f5:	c7 44 24 0c b3 d6 10 	movl   $0xc010d6b3,0xc(%esp)
c01067fc:	c0 
c01067fd:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c0106804:	c0 
c0106805:	c7 44 24 04 4f 01 00 	movl   $0x14f,0x4(%esp)
c010680c:	00 
c010680d:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c0106814:	e8 24 9c ff ff       	call   c010043d <__panic>

    struct vma_struct *vma = vma_create(0, PTSIZE, VM_WRITE);
c0106819:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
c0106820:	00 
c0106821:	c7 44 24 04 00 00 40 	movl   $0x400000,0x4(%esp)
c0106828:	00 
c0106829:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0106830:	e8 5a f3 ff ff       	call   c0105b8f <vma_create>
c0106835:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(vma != NULL);
c0106838:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c010683c:	75 24                	jne    c0106862 <check_pgfault+0xdc>
c010683e:	c7 44 24 0c 44 d5 10 	movl   $0xc010d544,0xc(%esp)
c0106845:	c0 
c0106846:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c010684d:	c0 
c010684e:	c7 44 24 04 52 01 00 	movl   $0x152,0x4(%esp)
c0106855:	00 
c0106856:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010685d:	e8 db 9b ff ff       	call   c010043d <__panic>

    insert_vma_struct(mm, vma);
c0106862:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106865:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106869:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010686c:	89 04 24             	mov    %eax,(%esp)
c010686f:	e8 b4 f4 ff ff       	call   c0105d28 <insert_vma_struct>

    uintptr_t addr = 0x100;
c0106874:	c7 45 dc 00 01 00 00 	movl   $0x100,-0x24(%ebp)
    assert(find_vma(mm, addr) == vma);
c010687b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010687e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106882:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106885:	89 04 24             	mov    %eax,(%esp)
c0106888:	e8 41 f3 ff ff       	call   c0105bce <find_vma>
c010688d:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0106890:	74 24                	je     c01068b6 <check_pgfault+0x130>
c0106892:	c7 44 24 0c c1 d6 10 	movl   $0xc010d6c1,0xc(%esp)
c0106899:	c0 
c010689a:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c01068a1:	c0 
c01068a2:	c7 44 24 04 57 01 00 	movl   $0x157,0x4(%esp)
c01068a9:	00 
c01068aa:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c01068b1:	e8 87 9b ff ff       	call   c010043d <__panic>

    int i, sum = 0;
c01068b6:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c01068bd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01068c4:	eb 16                	jmp    c01068dc <check_pgfault+0x156>
        *(char *)(addr + i) = i;
c01068c6:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01068c9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01068cc:	01 d0                	add    %edx,%eax
c01068ce:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01068d1:	88 10                	mov    %dl,(%eax)
        sum += i;
c01068d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01068d6:	01 45 f0             	add    %eax,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c01068d9:	ff 45 f4             	incl   -0xc(%ebp)
c01068dc:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c01068e0:	7e e4                	jle    c01068c6 <check_pgfault+0x140>
    }
    for (i = 0; i < 100; i ++) {
c01068e2:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01068e9:	eb 14                	jmp    c01068ff <check_pgfault+0x179>
        sum -= *(char *)(addr + i);
c01068eb:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01068ee:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01068f1:	01 d0                	add    %edx,%eax
c01068f3:	0f b6 00             	movzbl (%eax),%eax
c01068f6:	0f be c0             	movsbl %al,%eax
c01068f9:	29 45 f0             	sub    %eax,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c01068fc:	ff 45 f4             	incl   -0xc(%ebp)
c01068ff:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0106903:	7e e6                	jle    c01068eb <check_pgfault+0x165>
    }
    assert(sum == 0);
c0106905:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0106909:	74 24                	je     c010692f <check_pgfault+0x1a9>
c010690b:	c7 44 24 0c db d6 10 	movl   $0xc010d6db,0xc(%esp)
c0106912:	c0 
c0106913:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c010691a:	c0 
c010691b:	c7 44 24 04 61 01 00 	movl   $0x161,0x4(%esp)
c0106922:	00 
c0106923:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c010692a:	e8 0e 9b ff ff       	call   c010043d <__panic>

    page_remove(pgdir, ROUNDDOWN(addr, PGSIZE));
c010692f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106932:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0106935:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106938:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010693d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106941:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106944:	89 04 24             	mov    %eax,(%esp)
c0106947:	e8 21 dd ff ff       	call   c010466d <page_remove>
    free_page(pde2page(pgdir[0]));
c010694c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010694f:	8b 00                	mov    (%eax),%eax
c0106951:	89 04 24             	mov    %eax,(%esp)
c0106954:	e8 80 f1 ff ff       	call   c0105ad9 <pde2page>
c0106959:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106960:	00 
c0106961:	89 04 24             	mov    %eax,(%esp)
c0106964:	e8 7b d0 ff ff       	call   c01039e4 <free_pages>
    pgdir[0] = 0;
c0106969:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010696c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    mm->pgdir = NULL;
c0106972:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106975:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    mm_destroy(mm);
c010697c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010697f:	89 04 24             	mov    %eax,(%esp)
c0106982:	e8 d9 f4 ff ff       	call   c0105e60 <mm_destroy>
    check_mm_struct = NULL;
c0106987:	c7 05 6c 40 1b c0 00 	movl   $0x0,0xc01b406c
c010698e:	00 00 00 

    assert(nr_free_pages_store == nr_free_pages());
c0106991:	e8 85 d0 ff ff       	call   c0103a1b <nr_free_pages>
c0106996:	39 45 ec             	cmp    %eax,-0x14(%ebp)
c0106999:	74 24                	je     c01069bf <check_pgfault+0x239>
c010699b:	c7 44 24 0c e4 d6 10 	movl   $0xc010d6e4,0xc(%esp)
c01069a2:	c0 
c01069a3:	c7 44 24 08 53 d4 10 	movl   $0xc010d453,0x8(%esp)
c01069aa:	c0 
c01069ab:	c7 44 24 04 6b 01 00 	movl   $0x16b,0x4(%esp)
c01069b2:	00 
c01069b3:	c7 04 24 68 d4 10 c0 	movl   $0xc010d468,(%esp)
c01069ba:	e8 7e 9a ff ff       	call   c010043d <__panic>

    cprintf("check_pgfault() succeeded!\n");
c01069bf:	c7 04 24 0b d7 10 c0 	movl   $0xc010d70b,(%esp)
c01069c6:	e8 06 99 ff ff       	call   c01002d1 <cprintf>
}
c01069cb:	90                   	nop
c01069cc:	c9                   	leave  
c01069cd:	c3                   	ret    

c01069ce <do_pgfault>:
 *            was a read (0) or write (1).
 *         -- The U/S flag (bit 2) indicates whether the processor was executing at user mode (1)
 *            or supervisor mode (0) at the time of the exception.
 */
int
do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
c01069ce:	f3 0f 1e fb          	endbr32 
c01069d2:	55                   	push   %ebp
c01069d3:	89 e5                	mov    %esp,%ebp
c01069d5:	83 ec 38             	sub    $0x38,%esp
    int ret = -E_INVAL;
c01069d8:	c7 45 f4 fd ff ff ff 	movl   $0xfffffffd,-0xc(%ebp)
    //try to find a vma which include addr
    struct vma_struct *vma = find_vma(mm, addr);
c01069df:	8b 45 10             	mov    0x10(%ebp),%eax
c01069e2:	89 44 24 04          	mov    %eax,0x4(%esp)
c01069e6:	8b 45 08             	mov    0x8(%ebp),%eax
c01069e9:	89 04 24             	mov    %eax,(%esp)
c01069ec:	e8 dd f1 ff ff       	call   c0105bce <find_vma>
c01069f1:	89 45 ec             	mov    %eax,-0x14(%ebp)

    pgfault_num++;
c01069f4:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c01069f9:	40                   	inc    %eax
c01069fa:	a3 0c 20 1b c0       	mov    %eax,0xc01b200c
    //If the addr is in the range of a mm's vma?
    if (vma == NULL || vma->vm_start > addr) {
c01069ff:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106a03:	74 0b                	je     c0106a10 <do_pgfault+0x42>
c0106a05:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a08:	8b 40 04             	mov    0x4(%eax),%eax
c0106a0b:	39 45 10             	cmp    %eax,0x10(%ebp)
c0106a0e:	73 18                	jae    c0106a28 <do_pgfault+0x5a>
        cprintf("not valid addr %x, and  can not find it in vma\n", addr);
c0106a10:	8b 45 10             	mov    0x10(%ebp),%eax
c0106a13:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106a17:	c7 04 24 28 d7 10 c0 	movl   $0xc010d728,(%esp)
c0106a1e:	e8 ae 98 ff ff       	call   c01002d1 <cprintf>
        goto failed;
c0106a23:	e9 95 01 00 00       	jmp    c0106bbd <do_pgfault+0x1ef>
    }
    //check the error_code
    switch (error_code & 3) {
c0106a28:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106a2b:	83 e0 03             	and    $0x3,%eax
c0106a2e:	85 c0                	test   %eax,%eax
c0106a30:	74 34                	je     c0106a66 <do_pgfault+0x98>
c0106a32:	83 f8 01             	cmp    $0x1,%eax
c0106a35:	74 1e                	je     c0106a55 <do_pgfault+0x87>
    default:
            /* error code flag : default is 3 ( W/R=1, P=1): write, present */
    case 2: /* error code flag : (W/R=1, P=0): write, not present */
        if (!(vma->vm_flags & VM_WRITE)) {
c0106a37:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a3a:	8b 40 0c             	mov    0xc(%eax),%eax
c0106a3d:	83 e0 02             	and    $0x2,%eax
c0106a40:	85 c0                	test   %eax,%eax
c0106a42:	75 40                	jne    c0106a84 <do_pgfault+0xb6>
            cprintf("do_pgfault failed: error code flag = write AND not present, but the addr's vma cannot write\n");
c0106a44:	c7 04 24 58 d7 10 c0 	movl   $0xc010d758,(%esp)
c0106a4b:	e8 81 98 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0106a50:	e9 68 01 00 00       	jmp    c0106bbd <do_pgfault+0x1ef>
        }
        break;
    case 1: /* error code flag : (W/R=0, P=1): read, present */
        cprintf("do_pgfault failed: error code flag = read AND present\n");
c0106a55:	c7 04 24 b8 d7 10 c0 	movl   $0xc010d7b8,(%esp)
c0106a5c:	e8 70 98 ff ff       	call   c01002d1 <cprintf>
        goto failed;
c0106a61:	e9 57 01 00 00       	jmp    c0106bbd <do_pgfault+0x1ef>
    case 0: /* error code flag : (W/R=0, P=0): read, not present */
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
c0106a66:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a69:	8b 40 0c             	mov    0xc(%eax),%eax
c0106a6c:	83 e0 05             	and    $0x5,%eax
c0106a6f:	85 c0                	test   %eax,%eax
c0106a71:	75 12                	jne    c0106a85 <do_pgfault+0xb7>
            cprintf("do_pgfault failed: error code flag = read AND not present, but the addr's vma cannot read or exec\n");
c0106a73:	c7 04 24 f0 d7 10 c0 	movl   $0xc010d7f0,(%esp)
c0106a7a:	e8 52 98 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0106a7f:	e9 39 01 00 00       	jmp    c0106bbd <do_pgfault+0x1ef>
        break;
c0106a84:	90                   	nop
     *    (write an non_existed addr && addr is writable) OR
     *    (read  an non_existed addr && addr is readable)
     * THEN
     *    continue process
     */
    uint32_t perm = PTE_U;
c0106a85:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%ebp)
    if (vma->vm_flags & VM_WRITE) {
c0106a8c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a8f:	8b 40 0c             	mov    0xc(%eax),%eax
c0106a92:	83 e0 02             	and    $0x2,%eax
c0106a95:	85 c0                	test   %eax,%eax
c0106a97:	74 04                	je     c0106a9d <do_pgfault+0xcf>
        perm |= PTE_W;
c0106a99:	83 4d f0 02          	orl    $0x2,-0x10(%ebp)
    }
    addr = ROUNDDOWN(addr, PGSIZE);
c0106a9d:	8b 45 10             	mov    0x10(%ebp),%eax
c0106aa0:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106aa3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106aa6:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0106aab:	89 45 10             	mov    %eax,0x10(%ebp)

    ret = -E_NO_MEM;
c0106aae:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)

    pte_t *ptep=NULL;
c0106ab5:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    *   mm->pgdir : the PDT of these vma
    *
    */
    
    /*LAB3 EXERCISE 1: YOUR CODE*/
    if(!(ptep =get_pte(mm->pgdir,addr,1))) goto failed;              //(1) try to find a pte, if pte's PT(Page Table) isn't existed, then create a PT.
c0106abc:	8b 45 08             	mov    0x8(%ebp),%eax
c0106abf:	8b 40 0c             	mov    0xc(%eax),%eax
c0106ac2:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0106ac9:	00 
c0106aca:	8b 55 10             	mov    0x10(%ebp),%edx
c0106acd:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106ad1:	89 04 24             	mov    %eax,(%esp)
c0106ad4:	e8 6c d5 ff ff       	call   c0104045 <get_pte>
c0106ad9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0106adc:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0106ae0:	0f 84 d3 00 00 00    	je     c0106bb9 <do_pgfault+0x1eb>
    if (*ptep == 0) {
c0106ae6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106ae9:	8b 00                	mov    (%eax),%eax
c0106aeb:	85 c0                	test   %eax,%eax
c0106aed:	75 29                	jne    c0106b18 <do_pgfault+0x14a>
        if(pgdir_alloc_page(mm->pgdir,addr,perm)==NULL)
c0106aef:	8b 45 08             	mov    0x8(%ebp),%eax
c0106af2:	8b 40 0c             	mov    0xc(%eax),%eax
c0106af5:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106af8:	89 54 24 08          	mov    %edx,0x8(%esp)
c0106afc:	8b 55 10             	mov    0x10(%ebp),%edx
c0106aff:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106b03:	89 04 24             	mov    %eax,(%esp)
c0106b06:	e8 c9 dc ff ff       	call   c01047d4 <pgdir_alloc_page>
c0106b0b:	85 c0                	test   %eax,%eax
c0106b0d:	0f 85 9d 00 00 00    	jne    c0106bb0 <do_pgfault+0x1e2>
	    goto failed;         //(2) if the phy addr isn't exist, then alloc a page & map the phy addr with logical addr
c0106b13:	e9 a5 00 00 00       	jmp    c0106bbd <do_pgfault+0x1ef>
		     If the vma includes this addr is writable, then we can set the page writable by rewrite the *ptep.
		     This method could be used to implement the Copy on Write (COW) thchnology(a fast fork process method).
		  2) *ptep & PTE_P == 0 & but *ptep!=0, it means this pte is a  swap entry.
		     We should add the LAB3's results here.
     */
        if(swap_init_ok) {
c0106b18:	a1 14 20 1b c0       	mov    0xc01b2014,%eax
c0106b1d:	85 c0                	test   %eax,%eax
c0106b1f:	74 78                	je     c0106b99 <do_pgfault+0x1cb>
            struct Page *page=NULL;
c0106b21:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
            if(ret=swap_in(mm,addr,&page)) goto failed; //(1）According to the mm AND addr, try to load the content of right disk page
c0106b28:	8d 45 e0             	lea    -0x20(%ebp),%eax
c0106b2b:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106b2f:	8b 45 10             	mov    0x10(%ebp),%eax
c0106b32:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106b36:	8b 45 08             	mov    0x8(%ebp),%eax
c0106b39:	89 04 24             	mov    %eax,(%esp)
c0106b3c:	e8 61 0c 00 00       	call   c01077a2 <swap_in>
c0106b41:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106b44:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106b48:	75 72                	jne    c0106bbc <do_pgfault+0x1ee>
                                    //    into the memory which page managed.
            page_insert(mm->pgdir,page,addr,perm);                        //(2) According to the mm, addr AND page, setup the map of phy addr <---> logical addr
c0106b4a:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106b4d:	8b 45 08             	mov    0x8(%ebp),%eax
c0106b50:	8b 40 0c             	mov    0xc(%eax),%eax
c0106b53:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0106b56:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0106b5a:	8b 4d 10             	mov    0x10(%ebp),%ecx
c0106b5d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0106b61:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106b65:	89 04 24             	mov    %eax,(%esp)
c0106b68:	e8 49 db ff ff       	call   c01046b6 <page_insert>
            swap_map_swappable(mm,addr,page,1);//(3) make the page swappable.
c0106b6d:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106b70:	c7 44 24 0c 01 00 00 	movl   $0x1,0xc(%esp)
c0106b77:	00 
c0106b78:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106b7c:	8b 45 10             	mov    0x10(%ebp),%eax
c0106b7f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106b83:	8b 45 08             	mov    0x8(%ebp),%eax
c0106b86:	89 04 24             	mov    %eax,(%esp)
c0106b89:	e8 46 0a 00 00       	call   c01075d4 <swap_map_swappable>
            page->pra_vaddr=addr;
c0106b8e:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106b91:	8b 55 10             	mov    0x10(%ebp),%edx
c0106b94:	89 50 1c             	mov    %edx,0x1c(%eax)
c0106b97:	eb 17                	jmp    c0106bb0 <do_pgfault+0x1e2>
        }
        else {
            cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
c0106b99:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106b9c:	8b 00                	mov    (%eax),%eax
c0106b9e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106ba2:	c7 04 24 54 d8 10 c0 	movl   $0xc010d854,(%esp)
c0106ba9:	e8 23 97 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0106bae:	eb 0d                	jmp    c0106bbd <do_pgfault+0x1ef>
        }
   }
   ret = 0;
c0106bb0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0106bb7:	eb 04                	jmp    c0106bbd <do_pgfault+0x1ef>
    if(!(ptep =get_pte(mm->pgdir,addr,1))) goto failed;              //(1) try to find a pte, if pte's PT(Page Table) isn't existed, then create a PT.
c0106bb9:	90                   	nop
c0106bba:	eb 01                	jmp    c0106bbd <do_pgfault+0x1ef>
            if(ret=swap_in(mm,addr,&page)) goto failed; //(1）According to the mm AND addr, try to load the content of right disk page
c0106bbc:	90                   	nop
failed:
    return ret;
c0106bbd:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106bc0:	c9                   	leave  
c0106bc1:	c3                   	ret    

c0106bc2 <user_mem_check>:

bool
user_mem_check(struct mm_struct *mm, uintptr_t addr, size_t len, bool write) {
c0106bc2:	f3 0f 1e fb          	endbr32 
c0106bc6:	55                   	push   %ebp
c0106bc7:	89 e5                	mov    %esp,%ebp
c0106bc9:	83 ec 18             	sub    $0x18,%esp
    if (mm != NULL) {
c0106bcc:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0106bd0:	0f 84 e0 00 00 00    	je     c0106cb6 <user_mem_check+0xf4>
        if (!USER_ACCESS(addr, addr + len)) {
c0106bd6:	81 7d 0c ff ff 1f 00 	cmpl   $0x1fffff,0xc(%ebp)
c0106bdd:	76 1c                	jbe    c0106bfb <user_mem_check+0x39>
c0106bdf:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106be2:	8b 45 10             	mov    0x10(%ebp),%eax
c0106be5:	01 d0                	add    %edx,%eax
c0106be7:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0106bea:	73 0f                	jae    c0106bfb <user_mem_check+0x39>
c0106bec:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106bef:	8b 45 10             	mov    0x10(%ebp),%eax
c0106bf2:	01 d0                	add    %edx,%eax
c0106bf4:	3d 00 00 00 b0       	cmp    $0xb0000000,%eax
c0106bf9:	76 0a                	jbe    c0106c05 <user_mem_check+0x43>
            return 0;
c0106bfb:	b8 00 00 00 00       	mov    $0x0,%eax
c0106c00:	e9 e2 00 00 00       	jmp    c0106ce7 <user_mem_check+0x125>
        }
        struct vma_struct *vma;
        uintptr_t start = addr, end = addr + len;
c0106c05:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106c08:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0106c0b:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106c0e:	8b 45 10             	mov    0x10(%ebp),%eax
c0106c11:	01 d0                	add    %edx,%eax
c0106c13:	89 45 f8             	mov    %eax,-0x8(%ebp)
        while (start < end) {
c0106c16:	e9 88 00 00 00       	jmp    c0106ca3 <user_mem_check+0xe1>
            if ((vma = find_vma(mm, start)) == NULL || start < vma->vm_start) {
c0106c1b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0106c1e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106c22:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c25:	89 04 24             	mov    %eax,(%esp)
c0106c28:	e8 a1 ef ff ff       	call   c0105bce <find_vma>
c0106c2d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106c30:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106c34:	74 0b                	je     c0106c41 <user_mem_check+0x7f>
c0106c36:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106c39:	8b 40 04             	mov    0x4(%eax),%eax
c0106c3c:	39 45 fc             	cmp    %eax,-0x4(%ebp)
c0106c3f:	73 0a                	jae    c0106c4b <user_mem_check+0x89>
                return 0;
c0106c41:	b8 00 00 00 00       	mov    $0x0,%eax
c0106c46:	e9 9c 00 00 00       	jmp    c0106ce7 <user_mem_check+0x125>
            }
            if (!(vma->vm_flags & ((write) ? VM_WRITE : VM_READ))) {
c0106c4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106c4e:	8b 40 0c             	mov    0xc(%eax),%eax
c0106c51:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0106c55:	74 07                	je     c0106c5e <user_mem_check+0x9c>
c0106c57:	ba 02 00 00 00       	mov    $0x2,%edx
c0106c5c:	eb 05                	jmp    c0106c63 <user_mem_check+0xa1>
c0106c5e:	ba 01 00 00 00       	mov    $0x1,%edx
c0106c63:	21 d0                	and    %edx,%eax
c0106c65:	85 c0                	test   %eax,%eax
c0106c67:	75 07                	jne    c0106c70 <user_mem_check+0xae>
                return 0;
c0106c69:	b8 00 00 00 00       	mov    $0x0,%eax
c0106c6e:	eb 77                	jmp    c0106ce7 <user_mem_check+0x125>
            }
            if (write && (vma->vm_flags & VM_STACK)) {
c0106c70:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0106c74:	74 24                	je     c0106c9a <user_mem_check+0xd8>
c0106c76:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106c79:	8b 40 0c             	mov    0xc(%eax),%eax
c0106c7c:	83 e0 08             	and    $0x8,%eax
c0106c7f:	85 c0                	test   %eax,%eax
c0106c81:	74 17                	je     c0106c9a <user_mem_check+0xd8>
                if (start < vma->vm_start + PGSIZE) { //check stack start & size
c0106c83:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106c86:	8b 40 04             	mov    0x4(%eax),%eax
c0106c89:	05 00 10 00 00       	add    $0x1000,%eax
c0106c8e:	39 45 fc             	cmp    %eax,-0x4(%ebp)
c0106c91:	73 07                	jae    c0106c9a <user_mem_check+0xd8>
                    return 0;
c0106c93:	b8 00 00 00 00       	mov    $0x0,%eax
c0106c98:	eb 4d                	jmp    c0106ce7 <user_mem_check+0x125>
                }
            }
            start = vma->vm_end;
c0106c9a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106c9d:	8b 40 08             	mov    0x8(%eax),%eax
c0106ca0:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while (start < end) {
c0106ca3:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0106ca6:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c0106ca9:	0f 82 6c ff ff ff    	jb     c0106c1b <user_mem_check+0x59>
        }
        return 1;
c0106caf:	b8 01 00 00 00       	mov    $0x1,%eax
c0106cb4:	eb 31                	jmp    c0106ce7 <user_mem_check+0x125>
    }
    return KERN_ACCESS(addr, addr + len);
c0106cb6:	81 7d 0c ff ff ff bf 	cmpl   $0xbfffffff,0xc(%ebp)
c0106cbd:	76 23                	jbe    c0106ce2 <user_mem_check+0x120>
c0106cbf:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106cc2:	8b 45 10             	mov    0x10(%ebp),%eax
c0106cc5:	01 d0                	add    %edx,%eax
c0106cc7:	39 45 0c             	cmp    %eax,0xc(%ebp)
c0106cca:	73 16                	jae    c0106ce2 <user_mem_check+0x120>
c0106ccc:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106ccf:	8b 45 10             	mov    0x10(%ebp),%eax
c0106cd2:	01 d0                	add    %edx,%eax
c0106cd4:	3d 00 00 00 f8       	cmp    $0xf8000000,%eax
c0106cd9:	77 07                	ja     c0106ce2 <user_mem_check+0x120>
c0106cdb:	b8 01 00 00 00       	mov    $0x1,%eax
c0106ce0:	eb 05                	jmp    c0106ce7 <user_mem_check+0x125>
c0106ce2:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106ce7:	c9                   	leave  
c0106ce8:	c3                   	ret    

c0106ce9 <__intr_save>:
__intr_save(void) {
c0106ce9:	55                   	push   %ebp
c0106cea:	89 e5                	mov    %esp,%ebp
c0106cec:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0106cef:	9c                   	pushf  
c0106cf0:	58                   	pop    %eax
c0106cf1:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0106cf4:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0106cf7:	25 00 02 00 00       	and    $0x200,%eax
c0106cfc:	85 c0                	test   %eax,%eax
c0106cfe:	74 0c                	je     c0106d0c <__intr_save+0x23>
        intr_disable();
c0106d00:	e8 f3 b5 ff ff       	call   c01022f8 <intr_disable>
        return 1;
c0106d05:	b8 01 00 00 00       	mov    $0x1,%eax
c0106d0a:	eb 05                	jmp    c0106d11 <__intr_save+0x28>
    return 0;
c0106d0c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106d11:	c9                   	leave  
c0106d12:	c3                   	ret    

c0106d13 <__intr_restore>:
__intr_restore(bool flag) {
c0106d13:	55                   	push   %ebp
c0106d14:	89 e5                	mov    %esp,%ebp
c0106d16:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0106d19:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0106d1d:	74 05                	je     c0106d24 <__intr_restore+0x11>
        intr_enable();
c0106d1f:	e8 c8 b5 ff ff       	call   c01022ec <intr_enable>
}
c0106d24:	90                   	nop
c0106d25:	c9                   	leave  
c0106d26:	c3                   	ret    

c0106d27 <page2ppn>:
page2ppn(struct Page *page) {
c0106d27:	55                   	push   %ebp
c0106d28:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0106d2a:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c0106d2f:	8b 55 08             	mov    0x8(%ebp),%edx
c0106d32:	29 c2                	sub    %eax,%edx
c0106d34:	89 d0                	mov    %edx,%eax
c0106d36:	c1 f8 05             	sar    $0x5,%eax
}
c0106d39:	5d                   	pop    %ebp
c0106d3a:	c3                   	ret    

c0106d3b <page2pa>:
page2pa(struct Page *page) {
c0106d3b:	55                   	push   %ebp
c0106d3c:	89 e5                	mov    %esp,%ebp
c0106d3e:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0106d41:	8b 45 08             	mov    0x8(%ebp),%eax
c0106d44:	89 04 24             	mov    %eax,(%esp)
c0106d47:	e8 db ff ff ff       	call   c0106d27 <page2ppn>
c0106d4c:	c1 e0 0c             	shl    $0xc,%eax
}
c0106d4f:	c9                   	leave  
c0106d50:	c3                   	ret    

c0106d51 <pa2page>:
pa2page(uintptr_t pa) {
c0106d51:	55                   	push   %ebp
c0106d52:	89 e5                	mov    %esp,%ebp
c0106d54:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0106d57:	8b 45 08             	mov    0x8(%ebp),%eax
c0106d5a:	c1 e8 0c             	shr    $0xc,%eax
c0106d5d:	89 c2                	mov    %eax,%edx
c0106d5f:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0106d64:	39 c2                	cmp    %eax,%edx
c0106d66:	72 1c                	jb     c0106d84 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0106d68:	c7 44 24 08 7c d8 10 	movl   $0xc010d87c,0x8(%esp)
c0106d6f:	c0 
c0106d70:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
c0106d77:	00 
c0106d78:	c7 04 24 9b d8 10 c0 	movl   $0xc010d89b,(%esp)
c0106d7f:	e8 b9 96 ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0106d84:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c0106d89:	8b 55 08             	mov    0x8(%ebp),%edx
c0106d8c:	c1 ea 0c             	shr    $0xc,%edx
c0106d8f:	c1 e2 05             	shl    $0x5,%edx
c0106d92:	01 d0                	add    %edx,%eax
}
c0106d94:	c9                   	leave  
c0106d95:	c3                   	ret    

c0106d96 <page2kva>:
page2kva(struct Page *page) {
c0106d96:	55                   	push   %ebp
c0106d97:	89 e5                	mov    %esp,%ebp
c0106d99:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0106d9c:	8b 45 08             	mov    0x8(%ebp),%eax
c0106d9f:	89 04 24             	mov    %eax,(%esp)
c0106da2:	e8 94 ff ff ff       	call   c0106d3b <page2pa>
c0106da7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106daa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106dad:	c1 e8 0c             	shr    $0xc,%eax
c0106db0:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106db3:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0106db8:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0106dbb:	72 23                	jb     c0106de0 <page2kva+0x4a>
c0106dbd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106dc0:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106dc4:	c7 44 24 08 ac d8 10 	movl   $0xc010d8ac,0x8(%esp)
c0106dcb:	c0 
c0106dcc:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c0106dd3:	00 
c0106dd4:	c7 04 24 9b d8 10 c0 	movl   $0xc010d89b,(%esp)
c0106ddb:	e8 5d 96 ff ff       	call   c010043d <__panic>
c0106de0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106de3:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0106de8:	c9                   	leave  
c0106de9:	c3                   	ret    

c0106dea <kva2page>:
kva2page(void *kva) {
c0106dea:	55                   	push   %ebp
c0106deb:	89 e5                	mov    %esp,%ebp
c0106ded:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c0106df0:	8b 45 08             	mov    0x8(%ebp),%eax
c0106df3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106df6:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0106dfd:	77 23                	ja     c0106e22 <kva2page+0x38>
c0106dff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106e02:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106e06:	c7 44 24 08 d0 d8 10 	movl   $0xc010d8d0,0x8(%esp)
c0106e0d:	c0 
c0106e0e:	c7 44 24 04 6a 00 00 	movl   $0x6a,0x4(%esp)
c0106e15:	00 
c0106e16:	c7 04 24 9b d8 10 c0 	movl   $0xc010d89b,(%esp)
c0106e1d:	e8 1b 96 ff ff       	call   c010043d <__panic>
c0106e22:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106e25:	05 00 00 00 40       	add    $0x40000000,%eax
c0106e2a:	89 04 24             	mov    %eax,(%esp)
c0106e2d:	e8 1f ff ff ff       	call   c0106d51 <pa2page>
}
c0106e32:	c9                   	leave  
c0106e33:	c3                   	ret    

c0106e34 <__slob_get_free_pages>:
static slob_t *slobfree = &arena;
static bigblock_t *bigblocks;


static void* __slob_get_free_pages(gfp_t gfp, int order)
{
c0106e34:	f3 0f 1e fb          	endbr32 
c0106e38:	55                   	push   %ebp
c0106e39:	89 e5                	mov    %esp,%ebp
c0106e3b:	83 ec 28             	sub    $0x28,%esp
  struct Page * page = alloc_pages(1 << order);
c0106e3e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106e41:	ba 01 00 00 00       	mov    $0x1,%edx
c0106e46:	88 c1                	mov    %al,%cl
c0106e48:	d3 e2                	shl    %cl,%edx
c0106e4a:	89 d0                	mov    %edx,%eax
c0106e4c:	89 04 24             	mov    %eax,(%esp)
c0106e4f:	e8 21 cb ff ff       	call   c0103975 <alloc_pages>
c0106e54:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(!page)
c0106e57:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106e5b:	75 07                	jne    c0106e64 <__slob_get_free_pages+0x30>
    return NULL;
c0106e5d:	b8 00 00 00 00       	mov    $0x0,%eax
c0106e62:	eb 0b                	jmp    c0106e6f <__slob_get_free_pages+0x3b>
  return page2kva(page);
c0106e64:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106e67:	89 04 24             	mov    %eax,(%esp)
c0106e6a:	e8 27 ff ff ff       	call   c0106d96 <page2kva>
}
c0106e6f:	c9                   	leave  
c0106e70:	c3                   	ret    

c0106e71 <__slob_free_pages>:

#define __slob_get_free_page(gfp) __slob_get_free_pages(gfp, 0)

static inline void __slob_free_pages(unsigned long kva, int order)
{
c0106e71:	55                   	push   %ebp
c0106e72:	89 e5                	mov    %esp,%ebp
c0106e74:	53                   	push   %ebx
c0106e75:	83 ec 14             	sub    $0x14,%esp
  free_pages(kva2page(kva), 1 << order);
c0106e78:	8b 45 0c             	mov    0xc(%ebp),%eax
c0106e7b:	ba 01 00 00 00       	mov    $0x1,%edx
c0106e80:	88 c1                	mov    %al,%cl
c0106e82:	d3 e2                	shl    %cl,%edx
c0106e84:	89 d0                	mov    %edx,%eax
c0106e86:	89 c3                	mov    %eax,%ebx
c0106e88:	8b 45 08             	mov    0x8(%ebp),%eax
c0106e8b:	89 04 24             	mov    %eax,(%esp)
c0106e8e:	e8 57 ff ff ff       	call   c0106dea <kva2page>
c0106e93:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0106e97:	89 04 24             	mov    %eax,(%esp)
c0106e9a:	e8 45 cb ff ff       	call   c01039e4 <free_pages>
}
c0106e9f:	90                   	nop
c0106ea0:	83 c4 14             	add    $0x14,%esp
c0106ea3:	5b                   	pop    %ebx
c0106ea4:	5d                   	pop    %ebp
c0106ea5:	c3                   	ret    

c0106ea6 <slob_alloc>:

static void slob_free(void *b, int size);

static void *slob_alloc(size_t size, gfp_t gfp, int align)
{
c0106ea6:	f3 0f 1e fb          	endbr32 
c0106eaa:	55                   	push   %ebp
c0106eab:	89 e5                	mov    %esp,%ebp
c0106ead:	83 ec 38             	sub    $0x38,%esp
  assert( (size + SLOB_UNIT) < PAGE_SIZE );
c0106eb0:	8b 45 08             	mov    0x8(%ebp),%eax
c0106eb3:	83 c0 08             	add    $0x8,%eax
c0106eb6:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c0106ebb:	76 24                	jbe    c0106ee1 <slob_alloc+0x3b>
c0106ebd:	c7 44 24 0c f4 d8 10 	movl   $0xc010d8f4,0xc(%esp)
c0106ec4:	c0 
c0106ec5:	c7 44 24 08 13 d9 10 	movl   $0xc010d913,0x8(%esp)
c0106ecc:	c0 
c0106ecd:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c0106ed4:	00 
c0106ed5:	c7 04 24 28 d9 10 c0 	movl   $0xc010d928,(%esp)
c0106edc:	e8 5c 95 ff ff       	call   c010043d <__panic>

	slob_t *prev, *cur, *aligned = 0;
c0106ee1:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
	int delta = 0, units = SLOB_UNITS(size);
c0106ee8:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0106eef:	8b 45 08             	mov    0x8(%ebp),%eax
c0106ef2:	83 c0 07             	add    $0x7,%eax
c0106ef5:	c1 e8 03             	shr    $0x3,%eax
c0106ef8:	89 45 e0             	mov    %eax,-0x20(%ebp)
	unsigned long flags;

	spin_lock_irqsave(&slob_lock, flags);
c0106efb:	e8 e9 fd ff ff       	call   c0106ce9 <__intr_save>
c0106f00:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	prev = slobfree;
c0106f03:	a1 68 ea 12 c0       	mov    0xc012ea68,%eax
c0106f08:	89 45 f4             	mov    %eax,-0xc(%ebp)
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c0106f0b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106f0e:	8b 40 04             	mov    0x4(%eax),%eax
c0106f11:	89 45 f0             	mov    %eax,-0x10(%ebp)
		if (align) {
c0106f14:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0106f18:	74 21                	je     c0106f3b <slob_alloc+0x95>
			aligned = (slob_t *)ALIGN((unsigned long)cur, align);
c0106f1a:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106f1d:	8b 45 10             	mov    0x10(%ebp),%eax
c0106f20:	01 d0                	add    %edx,%eax
c0106f22:	8d 50 ff             	lea    -0x1(%eax),%edx
c0106f25:	8b 45 10             	mov    0x10(%ebp),%eax
c0106f28:	f7 d8                	neg    %eax
c0106f2a:	21 d0                	and    %edx,%eax
c0106f2c:	89 45 ec             	mov    %eax,-0x14(%ebp)
			delta = aligned - cur;
c0106f2f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f32:	2b 45 f0             	sub    -0x10(%ebp),%eax
c0106f35:	c1 f8 03             	sar    $0x3,%eax
c0106f38:	89 45 e8             	mov    %eax,-0x18(%ebp)
		}
		if (cur->units >= units + delta) { /* room enough? */
c0106f3b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f3e:	8b 00                	mov    (%eax),%eax
c0106f40:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c0106f43:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0106f46:	01 ca                	add    %ecx,%edx
c0106f48:	39 d0                	cmp    %edx,%eax
c0106f4a:	0f 8c aa 00 00 00    	jl     c0106ffa <slob_alloc+0x154>
			if (delta) { /* need to fragment head to align? */
c0106f50:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0106f54:	74 38                	je     c0106f8e <slob_alloc+0xe8>
				aligned->units = cur->units - delta;
c0106f56:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f59:	8b 00                	mov    (%eax),%eax
c0106f5b:	2b 45 e8             	sub    -0x18(%ebp),%eax
c0106f5e:	89 c2                	mov    %eax,%edx
c0106f60:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f63:	89 10                	mov    %edx,(%eax)
				aligned->next = cur->next;
c0106f65:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f68:	8b 50 04             	mov    0x4(%eax),%edx
c0106f6b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f6e:	89 50 04             	mov    %edx,0x4(%eax)
				cur->next = aligned;
c0106f71:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f74:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106f77:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = delta;
c0106f7a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f7d:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0106f80:	89 10                	mov    %edx,(%eax)
				prev = cur;
c0106f82:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f85:	89 45 f4             	mov    %eax,-0xc(%ebp)
				cur = aligned;
c0106f88:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f8b:	89 45 f0             	mov    %eax,-0x10(%ebp)
			}

			if (cur->units == units) /* exact fit? */
c0106f8e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f91:	8b 00                	mov    (%eax),%eax
c0106f93:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0106f96:	75 0e                	jne    c0106fa6 <slob_alloc+0x100>
				prev->next = cur->next; /* unlink */
c0106f98:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106f9b:	8b 50 04             	mov    0x4(%eax),%edx
c0106f9e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106fa1:	89 50 04             	mov    %edx,0x4(%eax)
c0106fa4:	eb 3c                	jmp    c0106fe2 <slob_alloc+0x13c>
			else { /* fragment */
				prev->next = cur + units;
c0106fa6:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106fa9:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0106fb0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106fb3:	01 c2                	add    %eax,%edx
c0106fb5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106fb8:	89 50 04             	mov    %edx,0x4(%eax)
				prev->next->units = cur->units - units;
c0106fbb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106fbe:	8b 10                	mov    (%eax),%edx
c0106fc0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106fc3:	8b 40 04             	mov    0x4(%eax),%eax
c0106fc6:	2b 55 e0             	sub    -0x20(%ebp),%edx
c0106fc9:	89 10                	mov    %edx,(%eax)
				prev->next->next = cur->next;
c0106fcb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106fce:	8b 40 04             	mov    0x4(%eax),%eax
c0106fd1:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106fd4:	8b 52 04             	mov    0x4(%edx),%edx
c0106fd7:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = units;
c0106fda:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106fdd:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106fe0:	89 10                	mov    %edx,(%eax)
			}

			slobfree = prev;
c0106fe2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106fe5:	a3 68 ea 12 c0       	mov    %eax,0xc012ea68
			spin_unlock_irqrestore(&slob_lock, flags);
c0106fea:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106fed:	89 04 24             	mov    %eax,(%esp)
c0106ff0:	e8 1e fd ff ff       	call   c0106d13 <__intr_restore>
			return cur;
c0106ff5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106ff8:	eb 7f                	jmp    c0107079 <slob_alloc+0x1d3>
		}
		if (cur == slobfree) {
c0106ffa:	a1 68 ea 12 c0       	mov    0xc012ea68,%eax
c0106fff:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0107002:	75 61                	jne    c0107065 <slob_alloc+0x1bf>
			spin_unlock_irqrestore(&slob_lock, flags);
c0107004:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107007:	89 04 24             	mov    %eax,(%esp)
c010700a:	e8 04 fd ff ff       	call   c0106d13 <__intr_restore>

			if (size == PAGE_SIZE) /* trying to shrink arena? */
c010700f:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c0107016:	75 07                	jne    c010701f <slob_alloc+0x179>
				return 0;
c0107018:	b8 00 00 00 00       	mov    $0x0,%eax
c010701d:	eb 5a                	jmp    c0107079 <slob_alloc+0x1d3>

			cur = (slob_t *)__slob_get_free_page(gfp);
c010701f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0107026:	00 
c0107027:	8b 45 0c             	mov    0xc(%ebp),%eax
c010702a:	89 04 24             	mov    %eax,(%esp)
c010702d:	e8 02 fe ff ff       	call   c0106e34 <__slob_get_free_pages>
c0107032:	89 45 f0             	mov    %eax,-0x10(%ebp)
			if (!cur)
c0107035:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107039:	75 07                	jne    c0107042 <slob_alloc+0x19c>
				return 0;
c010703b:	b8 00 00 00 00       	mov    $0x0,%eax
c0107040:	eb 37                	jmp    c0107079 <slob_alloc+0x1d3>

			slob_free(cur, PAGE_SIZE);
c0107042:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0107049:	00 
c010704a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010704d:	89 04 24             	mov    %eax,(%esp)
c0107050:	e8 26 00 00 00       	call   c010707b <slob_free>
			spin_lock_irqsave(&slob_lock, flags);
c0107055:	e8 8f fc ff ff       	call   c0106ce9 <__intr_save>
c010705a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
			cur = slobfree;
c010705d:	a1 68 ea 12 c0       	mov    0xc012ea68,%eax
c0107062:	89 45 f0             	mov    %eax,-0x10(%ebp)
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c0107065:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107068:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010706b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010706e:	8b 40 04             	mov    0x4(%eax),%eax
c0107071:	89 45 f0             	mov    %eax,-0x10(%ebp)
		if (align) {
c0107074:	e9 9b fe ff ff       	jmp    c0106f14 <slob_alloc+0x6e>
		}
	}
}
c0107079:	c9                   	leave  
c010707a:	c3                   	ret    

c010707b <slob_free>:

static void slob_free(void *block, int size)
{
c010707b:	f3 0f 1e fb          	endbr32 
c010707f:	55                   	push   %ebp
c0107080:	89 e5                	mov    %esp,%ebp
c0107082:	83 ec 28             	sub    $0x28,%esp
	slob_t *cur, *b = (slob_t *)block;
c0107085:	8b 45 08             	mov    0x8(%ebp),%eax
c0107088:	89 45 f0             	mov    %eax,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c010708b:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010708f:	0f 84 01 01 00 00    	je     c0107196 <slob_free+0x11b>
		return;

	if (size)
c0107095:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0107099:	74 10                	je     c01070ab <slob_free+0x30>
		b->units = SLOB_UNITS(size);
c010709b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010709e:	83 c0 07             	add    $0x7,%eax
c01070a1:	c1 e8 03             	shr    $0x3,%eax
c01070a4:	89 c2                	mov    %eax,%edx
c01070a6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01070a9:	89 10                	mov    %edx,(%eax)

	/* Find reinsertion point */
	spin_lock_irqsave(&slob_lock, flags);
c01070ab:	e8 39 fc ff ff       	call   c0106ce9 <__intr_save>
c01070b0:	89 45 ec             	mov    %eax,-0x14(%ebp)
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c01070b3:	a1 68 ea 12 c0       	mov    0xc012ea68,%eax
c01070b8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01070bb:	eb 27                	jmp    c01070e4 <slob_free+0x69>
		if (cur >= cur->next && (b > cur || b < cur->next))
c01070bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01070c0:	8b 40 04             	mov    0x4(%eax),%eax
c01070c3:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c01070c6:	72 13                	jb     c01070db <slob_free+0x60>
c01070c8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01070cb:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01070ce:	77 27                	ja     c01070f7 <slob_free+0x7c>
c01070d0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01070d3:	8b 40 04             	mov    0x4(%eax),%eax
c01070d6:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01070d9:	72 1c                	jb     c01070f7 <slob_free+0x7c>
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c01070db:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01070de:	8b 40 04             	mov    0x4(%eax),%eax
c01070e1:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01070e4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01070e7:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01070ea:	76 d1                	jbe    c01070bd <slob_free+0x42>
c01070ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01070ef:	8b 40 04             	mov    0x4(%eax),%eax
c01070f2:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01070f5:	73 c6                	jae    c01070bd <slob_free+0x42>
			break;

	if (b + b->units == cur->next) {
c01070f7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01070fa:	8b 00                	mov    (%eax),%eax
c01070fc:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0107103:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107106:	01 c2                	add    %eax,%edx
c0107108:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010710b:	8b 40 04             	mov    0x4(%eax),%eax
c010710e:	39 c2                	cmp    %eax,%edx
c0107110:	75 25                	jne    c0107137 <slob_free+0xbc>
		b->units += cur->next->units;
c0107112:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107115:	8b 10                	mov    (%eax),%edx
c0107117:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010711a:	8b 40 04             	mov    0x4(%eax),%eax
c010711d:	8b 00                	mov    (%eax),%eax
c010711f:	01 c2                	add    %eax,%edx
c0107121:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107124:	89 10                	mov    %edx,(%eax)
		b->next = cur->next->next;
c0107126:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107129:	8b 40 04             	mov    0x4(%eax),%eax
c010712c:	8b 50 04             	mov    0x4(%eax),%edx
c010712f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107132:	89 50 04             	mov    %edx,0x4(%eax)
c0107135:	eb 0c                	jmp    c0107143 <slob_free+0xc8>
	} else
		b->next = cur->next;
c0107137:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010713a:	8b 50 04             	mov    0x4(%eax),%edx
c010713d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107140:	89 50 04             	mov    %edx,0x4(%eax)

	if (cur + cur->units == b) {
c0107143:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107146:	8b 00                	mov    (%eax),%eax
c0107148:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c010714f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107152:	01 d0                	add    %edx,%eax
c0107154:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0107157:	75 1f                	jne    c0107178 <slob_free+0xfd>
		cur->units += b->units;
c0107159:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010715c:	8b 10                	mov    (%eax),%edx
c010715e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107161:	8b 00                	mov    (%eax),%eax
c0107163:	01 c2                	add    %eax,%edx
c0107165:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107168:	89 10                	mov    %edx,(%eax)
		cur->next = b->next;
c010716a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010716d:	8b 50 04             	mov    0x4(%eax),%edx
c0107170:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107173:	89 50 04             	mov    %edx,0x4(%eax)
c0107176:	eb 09                	jmp    c0107181 <slob_free+0x106>
	} else
		cur->next = b;
c0107178:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010717b:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010717e:	89 50 04             	mov    %edx,0x4(%eax)

	slobfree = cur;
c0107181:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107184:	a3 68 ea 12 c0       	mov    %eax,0xc012ea68

	spin_unlock_irqrestore(&slob_lock, flags);
c0107189:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010718c:	89 04 24             	mov    %eax,(%esp)
c010718f:	e8 7f fb ff ff       	call   c0106d13 <__intr_restore>
c0107194:	eb 01                	jmp    c0107197 <slob_free+0x11c>
		return;
c0107196:	90                   	nop
}
c0107197:	c9                   	leave  
c0107198:	c3                   	ret    

c0107199 <slob_init>:



void
slob_init(void) {
c0107199:	f3 0f 1e fb          	endbr32 
c010719d:	55                   	push   %ebp
c010719e:	89 e5                	mov    %esp,%ebp
c01071a0:	83 ec 18             	sub    $0x18,%esp
  cprintf("use SLOB allocator\n");
c01071a3:	c7 04 24 3a d9 10 c0 	movl   $0xc010d93a,(%esp)
c01071aa:	e8 22 91 ff ff       	call   c01002d1 <cprintf>
}
c01071af:	90                   	nop
c01071b0:	c9                   	leave  
c01071b1:	c3                   	ret    

c01071b2 <kmalloc_init>:

inline void 
kmalloc_init(void) {
c01071b2:	f3 0f 1e fb          	endbr32 
c01071b6:	55                   	push   %ebp
c01071b7:	89 e5                	mov    %esp,%ebp
c01071b9:	83 ec 18             	sub    $0x18,%esp
    slob_init();
c01071bc:	e8 d8 ff ff ff       	call   c0107199 <slob_init>
    cprintf("kmalloc_init() succeeded!\n");
c01071c1:	c7 04 24 4e d9 10 c0 	movl   $0xc010d94e,(%esp)
c01071c8:	e8 04 91 ff ff       	call   c01002d1 <cprintf>
}
c01071cd:	90                   	nop
c01071ce:	c9                   	leave  
c01071cf:	c3                   	ret    

c01071d0 <slob_allocated>:

size_t
slob_allocated(void) {
c01071d0:	f3 0f 1e fb          	endbr32 
c01071d4:	55                   	push   %ebp
c01071d5:	89 e5                	mov    %esp,%ebp
  return 0;
c01071d7:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01071dc:	5d                   	pop    %ebp
c01071dd:	c3                   	ret    

c01071de <kallocated>:

size_t
kallocated(void) {
c01071de:	f3 0f 1e fb          	endbr32 
c01071e2:	55                   	push   %ebp
c01071e3:	89 e5                	mov    %esp,%ebp
   return slob_allocated();
c01071e5:	e8 e6 ff ff ff       	call   c01071d0 <slob_allocated>
}
c01071ea:	5d                   	pop    %ebp
c01071eb:	c3                   	ret    

c01071ec <find_order>:

static int find_order(int size)
{
c01071ec:	f3 0f 1e fb          	endbr32 
c01071f0:	55                   	push   %ebp
c01071f1:	89 e5                	mov    %esp,%ebp
c01071f3:	83 ec 10             	sub    $0x10,%esp
	int order = 0;
c01071f6:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
	for ( ; size > 4096 ; size >>=1)
c01071fd:	eb 06                	jmp    c0107205 <find_order+0x19>
		order++;
c01071ff:	ff 45 fc             	incl   -0x4(%ebp)
	for ( ; size > 4096 ; size >>=1)
c0107202:	d1 7d 08             	sarl   0x8(%ebp)
c0107205:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c010720c:	7f f1                	jg     c01071ff <find_order+0x13>
	return order;
c010720e:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0107211:	c9                   	leave  
c0107212:	c3                   	ret    

c0107213 <__kmalloc>:

static void *__kmalloc(size_t size, gfp_t gfp)
{
c0107213:	f3 0f 1e fb          	endbr32 
c0107217:	55                   	push   %ebp
c0107218:	89 e5                	mov    %esp,%ebp
c010721a:	83 ec 28             	sub    $0x28,%esp
	slob_t *m;
	bigblock_t *bb;
	unsigned long flags;

	if (size < PAGE_SIZE - SLOB_UNIT) {
c010721d:	81 7d 08 f7 0f 00 00 	cmpl   $0xff7,0x8(%ebp)
c0107224:	77 3b                	ja     c0107261 <__kmalloc+0x4e>
		m = slob_alloc(size + SLOB_UNIT, gfp, 0);
c0107226:	8b 45 08             	mov    0x8(%ebp),%eax
c0107229:	8d 50 08             	lea    0x8(%eax),%edx
c010722c:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107233:	00 
c0107234:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107237:	89 44 24 04          	mov    %eax,0x4(%esp)
c010723b:	89 14 24             	mov    %edx,(%esp)
c010723e:	e8 63 fc ff ff       	call   c0106ea6 <slob_alloc>
c0107243:	89 45 ec             	mov    %eax,-0x14(%ebp)
		return m ? (void *)(m + 1) : 0;
c0107246:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010724a:	74 0b                	je     c0107257 <__kmalloc+0x44>
c010724c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010724f:	83 c0 08             	add    $0x8,%eax
c0107252:	e9 b0 00 00 00       	jmp    c0107307 <__kmalloc+0xf4>
c0107257:	b8 00 00 00 00       	mov    $0x0,%eax
c010725c:	e9 a6 00 00 00       	jmp    c0107307 <__kmalloc+0xf4>
	}

	bb = slob_alloc(sizeof(bigblock_t), gfp, 0);
c0107261:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107268:	00 
c0107269:	8b 45 0c             	mov    0xc(%ebp),%eax
c010726c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107270:	c7 04 24 0c 00 00 00 	movl   $0xc,(%esp)
c0107277:	e8 2a fc ff ff       	call   c0106ea6 <slob_alloc>
c010727c:	89 45 f4             	mov    %eax,-0xc(%ebp)
	if (!bb)
c010727f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107283:	75 07                	jne    c010728c <__kmalloc+0x79>
		return 0;
c0107285:	b8 00 00 00 00       	mov    $0x0,%eax
c010728a:	eb 7b                	jmp    c0107307 <__kmalloc+0xf4>

	bb->order = find_order(size);
c010728c:	8b 45 08             	mov    0x8(%ebp),%eax
c010728f:	89 04 24             	mov    %eax,(%esp)
c0107292:	e8 55 ff ff ff       	call   c01071ec <find_order>
c0107297:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010729a:	89 02                	mov    %eax,(%edx)
	bb->pages = (void *)__slob_get_free_pages(gfp, bb->order);
c010729c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010729f:	8b 00                	mov    (%eax),%eax
c01072a1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01072a5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01072a8:	89 04 24             	mov    %eax,(%esp)
c01072ab:	e8 84 fb ff ff       	call   c0106e34 <__slob_get_free_pages>
c01072b0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01072b3:	89 42 04             	mov    %eax,0x4(%edx)

	if (bb->pages) {
c01072b6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01072b9:	8b 40 04             	mov    0x4(%eax),%eax
c01072bc:	85 c0                	test   %eax,%eax
c01072be:	74 2f                	je     c01072ef <__kmalloc+0xdc>
		spin_lock_irqsave(&block_lock, flags);
c01072c0:	e8 24 fa ff ff       	call   c0106ce9 <__intr_save>
c01072c5:	89 45 f0             	mov    %eax,-0x10(%ebp)
		bb->next = bigblocks;
c01072c8:	8b 15 10 20 1b c0    	mov    0xc01b2010,%edx
c01072ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01072d1:	89 50 08             	mov    %edx,0x8(%eax)
		bigblocks = bb;
c01072d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01072d7:	a3 10 20 1b c0       	mov    %eax,0xc01b2010
		spin_unlock_irqrestore(&block_lock, flags);
c01072dc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01072df:	89 04 24             	mov    %eax,(%esp)
c01072e2:	e8 2c fa ff ff       	call   c0106d13 <__intr_restore>
		return bb->pages;
c01072e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01072ea:	8b 40 04             	mov    0x4(%eax),%eax
c01072ed:	eb 18                	jmp    c0107307 <__kmalloc+0xf4>
	}

	slob_free(bb, sizeof(bigblock_t));
c01072ef:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c01072f6:	00 
c01072f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01072fa:	89 04 24             	mov    %eax,(%esp)
c01072fd:	e8 79 fd ff ff       	call   c010707b <slob_free>
	return 0;
c0107302:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107307:	c9                   	leave  
c0107308:	c3                   	ret    

c0107309 <kmalloc>:

void *
kmalloc(size_t size)
{
c0107309:	f3 0f 1e fb          	endbr32 
c010730d:	55                   	push   %ebp
c010730e:	89 e5                	mov    %esp,%ebp
c0107310:	83 ec 18             	sub    $0x18,%esp
  return __kmalloc(size, 0);
c0107313:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010731a:	00 
c010731b:	8b 45 08             	mov    0x8(%ebp),%eax
c010731e:	89 04 24             	mov    %eax,(%esp)
c0107321:	e8 ed fe ff ff       	call   c0107213 <__kmalloc>
}
c0107326:	c9                   	leave  
c0107327:	c3                   	ret    

c0107328 <kfree>:


void kfree(void *block)
{
c0107328:	f3 0f 1e fb          	endbr32 
c010732c:	55                   	push   %ebp
c010732d:	89 e5                	mov    %esp,%ebp
c010732f:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb, **last = &bigblocks;
c0107332:	c7 45 f0 10 20 1b c0 	movl   $0xc01b2010,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c0107339:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010733d:	0f 84 a3 00 00 00    	je     c01073e6 <kfree+0xbe>
		return;

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c0107343:	8b 45 08             	mov    0x8(%ebp),%eax
c0107346:	25 ff 0f 00 00       	and    $0xfff,%eax
c010734b:	85 c0                	test   %eax,%eax
c010734d:	75 7f                	jne    c01073ce <kfree+0xa6>
		/* might be on the big block list */
		spin_lock_irqsave(&block_lock, flags);
c010734f:	e8 95 f9 ff ff       	call   c0106ce9 <__intr_save>
c0107354:	89 45 ec             	mov    %eax,-0x14(%ebp)
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c0107357:	a1 10 20 1b c0       	mov    0xc01b2010,%eax
c010735c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010735f:	eb 5c                	jmp    c01073bd <kfree+0x95>
			if (bb->pages == block) {
c0107361:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107364:	8b 40 04             	mov    0x4(%eax),%eax
c0107367:	39 45 08             	cmp    %eax,0x8(%ebp)
c010736a:	75 3f                	jne    c01073ab <kfree+0x83>
				*last = bb->next;
c010736c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010736f:	8b 50 08             	mov    0x8(%eax),%edx
c0107372:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107375:	89 10                	mov    %edx,(%eax)
				spin_unlock_irqrestore(&block_lock, flags);
c0107377:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010737a:	89 04 24             	mov    %eax,(%esp)
c010737d:	e8 91 f9 ff ff       	call   c0106d13 <__intr_restore>
				__slob_free_pages((unsigned long)block, bb->order);
c0107382:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107385:	8b 10                	mov    (%eax),%edx
c0107387:	8b 45 08             	mov    0x8(%ebp),%eax
c010738a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010738e:	89 04 24             	mov    %eax,(%esp)
c0107391:	e8 db fa ff ff       	call   c0106e71 <__slob_free_pages>
				slob_free(bb, sizeof(bigblock_t));
c0107396:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c010739d:	00 
c010739e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01073a1:	89 04 24             	mov    %eax,(%esp)
c01073a4:	e8 d2 fc ff ff       	call   c010707b <slob_free>
				return;
c01073a9:	eb 3c                	jmp    c01073e7 <kfree+0xbf>
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c01073ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01073ae:	83 c0 08             	add    $0x8,%eax
c01073b1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01073b4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01073b7:	8b 40 08             	mov    0x8(%eax),%eax
c01073ba:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01073bd:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01073c1:	75 9e                	jne    c0107361 <kfree+0x39>
			}
		}
		spin_unlock_irqrestore(&block_lock, flags);
c01073c3:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01073c6:	89 04 24             	mov    %eax,(%esp)
c01073c9:	e8 45 f9 ff ff       	call   c0106d13 <__intr_restore>
	}

	slob_free((slob_t *)block - 1, 0);
c01073ce:	8b 45 08             	mov    0x8(%ebp),%eax
c01073d1:	83 e8 08             	sub    $0x8,%eax
c01073d4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01073db:	00 
c01073dc:	89 04 24             	mov    %eax,(%esp)
c01073df:	e8 97 fc ff ff       	call   c010707b <slob_free>
	return;
c01073e4:	eb 01                	jmp    c01073e7 <kfree+0xbf>
		return;
c01073e6:	90                   	nop
}
c01073e7:	c9                   	leave  
c01073e8:	c3                   	ret    

c01073e9 <ksize>:


unsigned int ksize(const void *block)
{
c01073e9:	f3 0f 1e fb          	endbr32 
c01073ed:	55                   	push   %ebp
c01073ee:	89 e5                	mov    %esp,%ebp
c01073f0:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb;
	unsigned long flags;

	if (!block)
c01073f3:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01073f7:	75 07                	jne    c0107400 <ksize+0x17>
		return 0;
c01073f9:	b8 00 00 00 00       	mov    $0x0,%eax
c01073fe:	eb 6b                	jmp    c010746b <ksize+0x82>

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c0107400:	8b 45 08             	mov    0x8(%ebp),%eax
c0107403:	25 ff 0f 00 00       	and    $0xfff,%eax
c0107408:	85 c0                	test   %eax,%eax
c010740a:	75 54                	jne    c0107460 <ksize+0x77>
		spin_lock_irqsave(&block_lock, flags);
c010740c:	e8 d8 f8 ff ff       	call   c0106ce9 <__intr_save>
c0107411:	89 45 f0             	mov    %eax,-0x10(%ebp)
		for (bb = bigblocks; bb; bb = bb->next)
c0107414:	a1 10 20 1b c0       	mov    0xc01b2010,%eax
c0107419:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010741c:	eb 31                	jmp    c010744f <ksize+0x66>
			if (bb->pages == block) {
c010741e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107421:	8b 40 04             	mov    0x4(%eax),%eax
c0107424:	39 45 08             	cmp    %eax,0x8(%ebp)
c0107427:	75 1d                	jne    c0107446 <ksize+0x5d>
				spin_unlock_irqrestore(&slob_lock, flags);
c0107429:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010742c:	89 04 24             	mov    %eax,(%esp)
c010742f:	e8 df f8 ff ff       	call   c0106d13 <__intr_restore>
				return PAGE_SIZE << bb->order;
c0107434:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107437:	8b 00                	mov    (%eax),%eax
c0107439:	ba 00 10 00 00       	mov    $0x1000,%edx
c010743e:	88 c1                	mov    %al,%cl
c0107440:	d3 e2                	shl    %cl,%edx
c0107442:	89 d0                	mov    %edx,%eax
c0107444:	eb 25                	jmp    c010746b <ksize+0x82>
		for (bb = bigblocks; bb; bb = bb->next)
c0107446:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107449:	8b 40 08             	mov    0x8(%eax),%eax
c010744c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010744f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107453:	75 c9                	jne    c010741e <ksize+0x35>
			}
		spin_unlock_irqrestore(&block_lock, flags);
c0107455:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107458:	89 04 24             	mov    %eax,(%esp)
c010745b:	e8 b3 f8 ff ff       	call   c0106d13 <__intr_restore>
	}

	return ((slob_t *)block - 1)->units * SLOB_UNIT;
c0107460:	8b 45 08             	mov    0x8(%ebp),%eax
c0107463:	83 e8 08             	sub    $0x8,%eax
c0107466:	8b 00                	mov    (%eax),%eax
c0107468:	c1 e0 03             	shl    $0x3,%eax
}
c010746b:	c9                   	leave  
c010746c:	c3                   	ret    

c010746d <pa2page>:
pa2page(uintptr_t pa) {
c010746d:	55                   	push   %ebp
c010746e:	89 e5                	mov    %esp,%ebp
c0107470:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0107473:	8b 45 08             	mov    0x8(%ebp),%eax
c0107476:	c1 e8 0c             	shr    $0xc,%eax
c0107479:	89 c2                	mov    %eax,%edx
c010747b:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0107480:	39 c2                	cmp    %eax,%edx
c0107482:	72 1c                	jb     c01074a0 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0107484:	c7 44 24 08 6c d9 10 	movl   $0xc010d96c,0x8(%esp)
c010748b:	c0 
c010748c:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
c0107493:	00 
c0107494:	c7 04 24 8b d9 10 c0 	movl   $0xc010d98b,(%esp)
c010749b:	e8 9d 8f ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c01074a0:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c01074a5:	8b 55 08             	mov    0x8(%ebp),%edx
c01074a8:	c1 ea 0c             	shr    $0xc,%edx
c01074ab:	c1 e2 05             	shl    $0x5,%edx
c01074ae:	01 d0                	add    %edx,%eax
}
c01074b0:	c9                   	leave  
c01074b1:	c3                   	ret    

c01074b2 <pte2page>:
pte2page(pte_t pte) {
c01074b2:	55                   	push   %ebp
c01074b3:	89 e5                	mov    %esp,%ebp
c01074b5:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c01074b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01074bb:	83 e0 01             	and    $0x1,%eax
c01074be:	85 c0                	test   %eax,%eax
c01074c0:	75 1c                	jne    c01074de <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c01074c2:	c7 44 24 08 9c d9 10 	movl   $0xc010d99c,0x8(%esp)
c01074c9:	c0 
c01074ca:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c01074d1:	00 
c01074d2:	c7 04 24 8b d9 10 c0 	movl   $0xc010d98b,(%esp)
c01074d9:	e8 5f 8f ff ff       	call   c010043d <__panic>
    return pa2page(PTE_ADDR(pte));
c01074de:	8b 45 08             	mov    0x8(%ebp),%eax
c01074e1:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01074e6:	89 04 24             	mov    %eax,(%esp)
c01074e9:	e8 7f ff ff ff       	call   c010746d <pa2page>
}
c01074ee:	c9                   	leave  
c01074ef:	c3                   	ret    

c01074f0 <pde2page>:
pde2page(pde_t pde) {
c01074f0:	55                   	push   %ebp
c01074f1:	89 e5                	mov    %esp,%ebp
c01074f3:	83 ec 18             	sub    $0x18,%esp
    return pa2page(PDE_ADDR(pde));
c01074f6:	8b 45 08             	mov    0x8(%ebp),%eax
c01074f9:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01074fe:	89 04 24             	mov    %eax,(%esp)
c0107501:	e8 67 ff ff ff       	call   c010746d <pa2page>
}
c0107506:	c9                   	leave  
c0107507:	c3                   	ret    

c0107508 <swap_init>:

static void check_swap(void);

int
swap_init(void)
{
c0107508:	f3 0f 1e fb          	endbr32 
c010750c:	55                   	push   %ebp
c010750d:	89 e5                	mov    %esp,%ebp
c010750f:	83 ec 28             	sub    $0x28,%esp
     swapfs_init();
c0107512:	e8 27 1e 00 00       	call   c010933e <swapfs_init>

     if (!(1024 <= max_swap_offset && max_swap_offset < MAX_SWAP_OFFSET_LIMIT))
c0107517:	a1 1c 41 1b c0       	mov    0xc01b411c,%eax
c010751c:	3d ff 03 00 00       	cmp    $0x3ff,%eax
c0107521:	76 0c                	jbe    c010752f <swap_init+0x27>
c0107523:	a1 1c 41 1b c0       	mov    0xc01b411c,%eax
c0107528:	3d ff ff ff 00       	cmp    $0xffffff,%eax
c010752d:	76 25                	jbe    c0107554 <swap_init+0x4c>
     {
          panic("bad max_swap_offset %08x.\n", max_swap_offset);
c010752f:	a1 1c 41 1b c0       	mov    0xc01b411c,%eax
c0107534:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107538:	c7 44 24 08 bd d9 10 	movl   $0xc010d9bd,0x8(%esp)
c010753f:	c0 
c0107540:	c7 44 24 04 27 00 00 	movl   $0x27,0x4(%esp)
c0107547:	00 
c0107548:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c010754f:	e8 e9 8e ff ff       	call   c010043d <__panic>
     }
     

     sm = &swap_manager_fifo;
c0107554:	c7 05 1c 20 1b c0 40 	movl   $0xc012ea40,0xc01b201c
c010755b:	ea 12 c0 
     int r = sm->init();
c010755e:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c0107563:	8b 40 04             	mov    0x4(%eax),%eax
c0107566:	ff d0                	call   *%eax
c0107568:	89 45 f4             	mov    %eax,-0xc(%ebp)
     
     if (r == 0)
c010756b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010756f:	75 26                	jne    c0107597 <swap_init+0x8f>
     {
          swap_init_ok = 1;
c0107571:	c7 05 14 20 1b c0 01 	movl   $0x1,0xc01b2014
c0107578:	00 00 00 
          cprintf("SWAP: manager = %s\n", sm->name);
c010757b:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c0107580:	8b 00                	mov    (%eax),%eax
c0107582:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107586:	c7 04 24 e7 d9 10 c0 	movl   $0xc010d9e7,(%esp)
c010758d:	e8 3f 8d ff ff       	call   c01002d1 <cprintf>
          check_swap();
c0107592:	e8 b6 04 00 00       	call   c0107a4d <check_swap>
     }

     return r;
c0107597:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010759a:	c9                   	leave  
c010759b:	c3                   	ret    

c010759c <swap_init_mm>:

int
swap_init_mm(struct mm_struct *mm)
{
c010759c:	f3 0f 1e fb          	endbr32 
c01075a0:	55                   	push   %ebp
c01075a1:	89 e5                	mov    %esp,%ebp
c01075a3:	83 ec 18             	sub    $0x18,%esp
     return sm->init_mm(mm);
c01075a6:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c01075ab:	8b 40 08             	mov    0x8(%eax),%eax
c01075ae:	8b 55 08             	mov    0x8(%ebp),%edx
c01075b1:	89 14 24             	mov    %edx,(%esp)
c01075b4:	ff d0                	call   *%eax
}
c01075b6:	c9                   	leave  
c01075b7:	c3                   	ret    

c01075b8 <swap_tick_event>:

int
swap_tick_event(struct mm_struct *mm)
{
c01075b8:	f3 0f 1e fb          	endbr32 
c01075bc:	55                   	push   %ebp
c01075bd:	89 e5                	mov    %esp,%ebp
c01075bf:	83 ec 18             	sub    $0x18,%esp
     return sm->tick_event(mm);
c01075c2:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c01075c7:	8b 40 0c             	mov    0xc(%eax),%eax
c01075ca:	8b 55 08             	mov    0x8(%ebp),%edx
c01075cd:	89 14 24             	mov    %edx,(%esp)
c01075d0:	ff d0                	call   *%eax
}
c01075d2:	c9                   	leave  
c01075d3:	c3                   	ret    

c01075d4 <swap_map_swappable>:

int
swap_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c01075d4:	f3 0f 1e fb          	endbr32 
c01075d8:	55                   	push   %ebp
c01075d9:	89 e5                	mov    %esp,%ebp
c01075db:	83 ec 18             	sub    $0x18,%esp
     return sm->map_swappable(mm, addr, page, swap_in);
c01075de:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c01075e3:	8b 40 10             	mov    0x10(%eax),%eax
c01075e6:	8b 55 14             	mov    0x14(%ebp),%edx
c01075e9:	89 54 24 0c          	mov    %edx,0xc(%esp)
c01075ed:	8b 55 10             	mov    0x10(%ebp),%edx
c01075f0:	89 54 24 08          	mov    %edx,0x8(%esp)
c01075f4:	8b 55 0c             	mov    0xc(%ebp),%edx
c01075f7:	89 54 24 04          	mov    %edx,0x4(%esp)
c01075fb:	8b 55 08             	mov    0x8(%ebp),%edx
c01075fe:	89 14 24             	mov    %edx,(%esp)
c0107601:	ff d0                	call   *%eax
}
c0107603:	c9                   	leave  
c0107604:	c3                   	ret    

c0107605 <swap_set_unswappable>:

int
swap_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c0107605:	f3 0f 1e fb          	endbr32 
c0107609:	55                   	push   %ebp
c010760a:	89 e5                	mov    %esp,%ebp
c010760c:	83 ec 18             	sub    $0x18,%esp
     return sm->set_unswappable(mm, addr);
c010760f:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c0107614:	8b 40 14             	mov    0x14(%eax),%eax
c0107617:	8b 55 0c             	mov    0xc(%ebp),%edx
c010761a:	89 54 24 04          	mov    %edx,0x4(%esp)
c010761e:	8b 55 08             	mov    0x8(%ebp),%edx
c0107621:	89 14 24             	mov    %edx,(%esp)
c0107624:	ff d0                	call   *%eax
}
c0107626:	c9                   	leave  
c0107627:	c3                   	ret    

c0107628 <swap_out>:

volatile unsigned int swap_out_num=0;

int
swap_out(struct mm_struct *mm, int n, int in_tick)
{
c0107628:	f3 0f 1e fb          	endbr32 
c010762c:	55                   	push   %ebp
c010762d:	89 e5                	mov    %esp,%ebp
c010762f:	83 ec 38             	sub    $0x38,%esp
     int i;
     for (i = 0; i != n; ++ i)
c0107632:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107639:	e9 53 01 00 00       	jmp    c0107791 <swap_out+0x169>
     {
          uintptr_t v;
          //struct Page **ptr_page=NULL;
          struct Page *page;
          // cprintf("i %d, SWAP: call swap_out_victim\n",i);
          int r = sm->swap_out_victim(mm, &page, in_tick);
c010763e:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c0107643:	8b 40 18             	mov    0x18(%eax),%eax
c0107646:	8b 55 10             	mov    0x10(%ebp),%edx
c0107649:	89 54 24 08          	mov    %edx,0x8(%esp)
c010764d:	8d 55 e4             	lea    -0x1c(%ebp),%edx
c0107650:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107654:	8b 55 08             	mov    0x8(%ebp),%edx
c0107657:	89 14 24             	mov    %edx,(%esp)
c010765a:	ff d0                	call   *%eax
c010765c:	89 45 f0             	mov    %eax,-0x10(%ebp)
          if (r != 0) {
c010765f:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107663:	74 18                	je     c010767d <swap_out+0x55>
                    cprintf("i %d, swap_out: call swap_out_victim failed\n",i);
c0107665:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107668:	89 44 24 04          	mov    %eax,0x4(%esp)
c010766c:	c7 04 24 fc d9 10 c0 	movl   $0xc010d9fc,(%esp)
c0107673:	e8 59 8c ff ff       	call   c01002d1 <cprintf>
c0107678:	e9 20 01 00 00       	jmp    c010779d <swap_out+0x175>
          }          
          //assert(!PageReserved(page));

          //cprintf("SWAP: choose victim page 0x%08x\n", page);
          
          v=page->pra_vaddr; 
c010767d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107680:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107683:	89 45 ec             	mov    %eax,-0x14(%ebp)
          pte_t *ptep = get_pte(mm->pgdir, v, 0);
c0107686:	8b 45 08             	mov    0x8(%ebp),%eax
c0107689:	8b 40 0c             	mov    0xc(%eax),%eax
c010768c:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107693:	00 
c0107694:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107697:	89 54 24 04          	mov    %edx,0x4(%esp)
c010769b:	89 04 24             	mov    %eax,(%esp)
c010769e:	e8 a2 c9 ff ff       	call   c0104045 <get_pte>
c01076a3:	89 45 e8             	mov    %eax,-0x18(%ebp)
          assert((*ptep & PTE_P) != 0);
c01076a6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01076a9:	8b 00                	mov    (%eax),%eax
c01076ab:	83 e0 01             	and    $0x1,%eax
c01076ae:	85 c0                	test   %eax,%eax
c01076b0:	75 24                	jne    c01076d6 <swap_out+0xae>
c01076b2:	c7 44 24 0c 29 da 10 	movl   $0xc010da29,0xc(%esp)
c01076b9:	c0 
c01076ba:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c01076c1:	c0 
c01076c2:	c7 44 24 04 67 00 00 	movl   $0x67,0x4(%esp)
c01076c9:	00 
c01076ca:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c01076d1:	e8 67 8d ff ff       	call   c010043d <__panic>

          if (swapfs_write( (page->pra_vaddr/PGSIZE+1)<<8, page) != 0) {
c01076d6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01076d9:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01076dc:	8b 52 1c             	mov    0x1c(%edx),%edx
c01076df:	c1 ea 0c             	shr    $0xc,%edx
c01076e2:	42                   	inc    %edx
c01076e3:	c1 e2 08             	shl    $0x8,%edx
c01076e6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01076ea:	89 14 24             	mov    %edx,(%esp)
c01076ed:	e8 0f 1d 00 00       	call   c0109401 <swapfs_write>
c01076f2:	85 c0                	test   %eax,%eax
c01076f4:	74 34                	je     c010772a <swap_out+0x102>
                    cprintf("SWAP: failed to save\n");
c01076f6:	c7 04 24 53 da 10 c0 	movl   $0xc010da53,(%esp)
c01076fd:	e8 cf 8b ff ff       	call   c01002d1 <cprintf>
                    sm->map_swappable(mm, v, page, 0);
c0107702:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c0107707:	8b 40 10             	mov    0x10(%eax),%eax
c010770a:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010770d:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0107714:	00 
c0107715:	89 54 24 08          	mov    %edx,0x8(%esp)
c0107719:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010771c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107720:	8b 55 08             	mov    0x8(%ebp),%edx
c0107723:	89 14 24             	mov    %edx,(%esp)
c0107726:	ff d0                	call   *%eax
c0107728:	eb 64                	jmp    c010778e <swap_out+0x166>
                    continue;
          }
          else {
                    cprintf("swap_out: i %d, store page in vaddr 0x%x to disk swap entry %d\n", i, v, page->pra_vaddr/PGSIZE+1);
c010772a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010772d:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107730:	c1 e8 0c             	shr    $0xc,%eax
c0107733:	40                   	inc    %eax
c0107734:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107738:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010773b:	89 44 24 08          	mov    %eax,0x8(%esp)
c010773f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107742:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107746:	c7 04 24 6c da 10 c0 	movl   $0xc010da6c,(%esp)
c010774d:	e8 7f 8b ff ff       	call   c01002d1 <cprintf>
                    *ptep = (page->pra_vaddr/PGSIZE+1)<<8;
c0107752:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107755:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107758:	c1 e8 0c             	shr    $0xc,%eax
c010775b:	40                   	inc    %eax
c010775c:	c1 e0 08             	shl    $0x8,%eax
c010775f:	89 c2                	mov    %eax,%edx
c0107761:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107764:	89 10                	mov    %edx,(%eax)
                    free_page(page);
c0107766:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107769:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107770:	00 
c0107771:	89 04 24             	mov    %eax,(%esp)
c0107774:	e8 6b c2 ff ff       	call   c01039e4 <free_pages>
          }
          
          tlb_invalidate(mm->pgdir, v);
c0107779:	8b 45 08             	mov    0x8(%ebp),%eax
c010777c:	8b 40 0c             	mov    0xc(%eax),%eax
c010777f:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107782:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107786:	89 04 24             	mov    %eax,(%esp)
c0107789:	e8 e5 cf ff ff       	call   c0104773 <tlb_invalidate>
     for (i = 0; i != n; ++ i)
c010778e:	ff 45 f4             	incl   -0xc(%ebp)
c0107791:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107794:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0107797:	0f 85 a1 fe ff ff    	jne    c010763e <swap_out+0x16>
     }
     return i;
c010779d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01077a0:	c9                   	leave  
c01077a1:	c3                   	ret    

c01077a2 <swap_in>:

int
swap_in(struct mm_struct *mm, uintptr_t addr, struct Page **ptr_result)
{
c01077a2:	f3 0f 1e fb          	endbr32 
c01077a6:	55                   	push   %ebp
c01077a7:	89 e5                	mov    %esp,%ebp
c01077a9:	83 ec 28             	sub    $0x28,%esp
     struct Page *result = alloc_page();
c01077ac:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01077b3:	e8 bd c1 ff ff       	call   c0103975 <alloc_pages>
c01077b8:	89 45 f4             	mov    %eax,-0xc(%ebp)
     assert(result!=NULL);
c01077bb:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01077bf:	75 24                	jne    c01077e5 <swap_in+0x43>
c01077c1:	c7 44 24 0c ac da 10 	movl   $0xc010daac,0xc(%esp)
c01077c8:	c0 
c01077c9:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c01077d0:	c0 
c01077d1:	c7 44 24 04 7d 00 00 	movl   $0x7d,0x4(%esp)
c01077d8:	00 
c01077d9:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c01077e0:	e8 58 8c ff ff       	call   c010043d <__panic>

     pte_t *ptep = get_pte(mm->pgdir, addr, 0);
c01077e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01077e8:	8b 40 0c             	mov    0xc(%eax),%eax
c01077eb:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01077f2:	00 
c01077f3:	8b 55 0c             	mov    0xc(%ebp),%edx
c01077f6:	89 54 24 04          	mov    %edx,0x4(%esp)
c01077fa:	89 04 24             	mov    %eax,(%esp)
c01077fd:	e8 43 c8 ff ff       	call   c0104045 <get_pte>
c0107802:	89 45 f0             	mov    %eax,-0x10(%ebp)
     // cprintf("SWAP: load ptep %x swap entry %d to vaddr 0x%08x, page %x, No %d\n", ptep, (*ptep)>>8, addr, result, (result-pages));
    
     int r;
     if ((r = swapfs_read((*ptep), result)) != 0)
c0107805:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107808:	8b 00                	mov    (%eax),%eax
c010780a:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010780d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107811:	89 04 24             	mov    %eax,(%esp)
c0107814:	e8 72 1b 00 00       	call   c010938b <swapfs_read>
c0107819:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010781c:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0107820:	74 2a                	je     c010784c <swap_in+0xaa>
     {
        assert(r!=0);
c0107822:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0107826:	75 24                	jne    c010784c <swap_in+0xaa>
c0107828:	c7 44 24 0c b9 da 10 	movl   $0xc010dab9,0xc(%esp)
c010782f:	c0 
c0107830:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107837:	c0 
c0107838:	c7 44 24 04 85 00 00 	movl   $0x85,0x4(%esp)
c010783f:	00 
c0107840:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107847:	e8 f1 8b ff ff       	call   c010043d <__panic>
     }
     cprintf("swap_in: load disk swap entry %d with swap_page in vadr 0x%x\n", (*ptep)>>8, addr);
c010784c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010784f:	8b 00                	mov    (%eax),%eax
c0107851:	c1 e8 08             	shr    $0x8,%eax
c0107854:	89 c2                	mov    %eax,%edx
c0107856:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107859:	89 44 24 08          	mov    %eax,0x8(%esp)
c010785d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107861:	c7 04 24 c0 da 10 c0 	movl   $0xc010dac0,(%esp)
c0107868:	e8 64 8a ff ff       	call   c01002d1 <cprintf>
     *ptr_result=result;
c010786d:	8b 45 10             	mov    0x10(%ebp),%eax
c0107870:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107873:	89 10                	mov    %edx,(%eax)
     return 0;
c0107875:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010787a:	c9                   	leave  
c010787b:	c3                   	ret    

c010787c <check_content_set>:



static inline void
check_content_set(void)
{
c010787c:	55                   	push   %ebp
c010787d:	89 e5                	mov    %esp,%ebp
c010787f:	83 ec 18             	sub    $0x18,%esp
     *(unsigned char *)0x1000 = 0x0a;
c0107882:	b8 00 10 00 00       	mov    $0x1000,%eax
c0107887:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c010788a:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010788f:	83 f8 01             	cmp    $0x1,%eax
c0107892:	74 24                	je     c01078b8 <check_content_set+0x3c>
c0107894:	c7 44 24 0c fe da 10 	movl   $0xc010dafe,0xc(%esp)
c010789b:	c0 
c010789c:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c01078a3:	c0 
c01078a4:	c7 44 24 04 92 00 00 	movl   $0x92,0x4(%esp)
c01078ab:	00 
c01078ac:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c01078b3:	e8 85 8b ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x1010 = 0x0a;
c01078b8:	b8 10 10 00 00       	mov    $0x1010,%eax
c01078bd:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c01078c0:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c01078c5:	83 f8 01             	cmp    $0x1,%eax
c01078c8:	74 24                	je     c01078ee <check_content_set+0x72>
c01078ca:	c7 44 24 0c fe da 10 	movl   $0xc010dafe,0xc(%esp)
c01078d1:	c0 
c01078d2:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c01078d9:	c0 
c01078da:	c7 44 24 04 94 00 00 	movl   $0x94,0x4(%esp)
c01078e1:	00 
c01078e2:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c01078e9:	e8 4f 8b ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x2000 = 0x0b;
c01078ee:	b8 00 20 00 00       	mov    $0x2000,%eax
c01078f3:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c01078f6:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c01078fb:	83 f8 02             	cmp    $0x2,%eax
c01078fe:	74 24                	je     c0107924 <check_content_set+0xa8>
c0107900:	c7 44 24 0c 0d db 10 	movl   $0xc010db0d,0xc(%esp)
c0107907:	c0 
c0107908:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c010790f:	c0 
c0107910:	c7 44 24 04 96 00 00 	movl   $0x96,0x4(%esp)
c0107917:	00 
c0107918:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c010791f:	e8 19 8b ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x2010 = 0x0b;
c0107924:	b8 10 20 00 00       	mov    $0x2010,%eax
c0107929:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c010792c:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c0107931:	83 f8 02             	cmp    $0x2,%eax
c0107934:	74 24                	je     c010795a <check_content_set+0xde>
c0107936:	c7 44 24 0c 0d db 10 	movl   $0xc010db0d,0xc(%esp)
c010793d:	c0 
c010793e:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107945:	c0 
c0107946:	c7 44 24 04 98 00 00 	movl   $0x98,0x4(%esp)
c010794d:	00 
c010794e:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107955:	e8 e3 8a ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x3000 = 0x0c;
c010795a:	b8 00 30 00 00       	mov    $0x3000,%eax
c010795f:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c0107962:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c0107967:	83 f8 03             	cmp    $0x3,%eax
c010796a:	74 24                	je     c0107990 <check_content_set+0x114>
c010796c:	c7 44 24 0c 1c db 10 	movl   $0xc010db1c,0xc(%esp)
c0107973:	c0 
c0107974:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c010797b:	c0 
c010797c:	c7 44 24 04 9a 00 00 	movl   $0x9a,0x4(%esp)
c0107983:	00 
c0107984:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c010798b:	e8 ad 8a ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x3010 = 0x0c;
c0107990:	b8 10 30 00 00       	mov    $0x3010,%eax
c0107995:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c0107998:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c010799d:	83 f8 03             	cmp    $0x3,%eax
c01079a0:	74 24                	je     c01079c6 <check_content_set+0x14a>
c01079a2:	c7 44 24 0c 1c db 10 	movl   $0xc010db1c,0xc(%esp)
c01079a9:	c0 
c01079aa:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c01079b1:	c0 
c01079b2:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
c01079b9:	00 
c01079ba:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c01079c1:	e8 77 8a ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x4000 = 0x0d;
c01079c6:	b8 00 40 00 00       	mov    $0x4000,%eax
c01079cb:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c01079ce:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c01079d3:	83 f8 04             	cmp    $0x4,%eax
c01079d6:	74 24                	je     c01079fc <check_content_set+0x180>
c01079d8:	c7 44 24 0c 2b db 10 	movl   $0xc010db2b,0xc(%esp)
c01079df:	c0 
c01079e0:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c01079e7:	c0 
c01079e8:	c7 44 24 04 9e 00 00 	movl   $0x9e,0x4(%esp)
c01079ef:	00 
c01079f0:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c01079f7:	e8 41 8a ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x4010 = 0x0d;
c01079fc:	b8 10 40 00 00       	mov    $0x4010,%eax
c0107a01:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c0107a04:	a1 0c 20 1b c0       	mov    0xc01b200c,%eax
c0107a09:	83 f8 04             	cmp    $0x4,%eax
c0107a0c:	74 24                	je     c0107a32 <check_content_set+0x1b6>
c0107a0e:	c7 44 24 0c 2b db 10 	movl   $0xc010db2b,0xc(%esp)
c0107a15:	c0 
c0107a16:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107a1d:	c0 
c0107a1e:	c7 44 24 04 a0 00 00 	movl   $0xa0,0x4(%esp)
c0107a25:	00 
c0107a26:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107a2d:	e8 0b 8a ff ff       	call   c010043d <__panic>
}
c0107a32:	90                   	nop
c0107a33:	c9                   	leave  
c0107a34:	c3                   	ret    

c0107a35 <check_content_access>:

static inline int
check_content_access(void)
{
c0107a35:	55                   	push   %ebp
c0107a36:	89 e5                	mov    %esp,%ebp
c0107a38:	83 ec 18             	sub    $0x18,%esp
    int ret = sm->check_swap();
c0107a3b:	a1 1c 20 1b c0       	mov    0xc01b201c,%eax
c0107a40:	8b 40 1c             	mov    0x1c(%eax),%eax
c0107a43:	ff d0                	call   *%eax
c0107a45:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return ret;
c0107a48:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0107a4b:	c9                   	leave  
c0107a4c:	c3                   	ret    

c0107a4d <check_swap>:
#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
check_swap(void)
{
c0107a4d:	f3 0f 1e fb          	endbr32 
c0107a51:	55                   	push   %ebp
c0107a52:	89 e5                	mov    %esp,%ebp
c0107a54:	83 ec 78             	sub    $0x78,%esp
    //backup mem env
     int ret, count = 0, total = 0, i;
c0107a57:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107a5e:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
     list_entry_t *le = &free_list;
c0107a65:	c7 45 e8 44 41 1b c0 	movl   $0xc01b4144,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c0107a6c:	eb 6a                	jmp    c0107ad8 <check_swap+0x8b>
        struct Page *p = le2page(le, page_link);
c0107a6e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107a71:	83 e8 0c             	sub    $0xc,%eax
c0107a74:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(PageProperty(p));
c0107a77:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0107a7a:	83 c0 04             	add    $0x4,%eax
c0107a7d:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c0107a84:	89 45 c0             	mov    %eax,-0x40(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0107a87:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0107a8a:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0107a8d:	0f a3 10             	bt     %edx,(%eax)
c0107a90:	19 c0                	sbb    %eax,%eax
c0107a92:	89 45 bc             	mov    %eax,-0x44(%ebp)
    return oldbit != 0;
c0107a95:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0107a99:	0f 95 c0             	setne  %al
c0107a9c:	0f b6 c0             	movzbl %al,%eax
c0107a9f:	85 c0                	test   %eax,%eax
c0107aa1:	75 24                	jne    c0107ac7 <check_swap+0x7a>
c0107aa3:	c7 44 24 0c 3a db 10 	movl   $0xc010db3a,0xc(%esp)
c0107aaa:	c0 
c0107aab:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107ab2:	c0 
c0107ab3:	c7 44 24 04 bb 00 00 	movl   $0xbb,0x4(%esp)
c0107aba:	00 
c0107abb:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107ac2:	e8 76 89 ff ff       	call   c010043d <__panic>
        count ++, total += p->property;
c0107ac7:	ff 45 f4             	incl   -0xc(%ebp)
c0107aca:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0107acd:	8b 50 08             	mov    0x8(%eax),%edx
c0107ad0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107ad3:	01 d0                	add    %edx,%eax
c0107ad5:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107ad8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107adb:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0107ade:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0107ae1:	8b 40 04             	mov    0x4(%eax),%eax
     while ((le = list_next(le)) != &free_list) {
c0107ae4:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107ae7:	81 7d e8 44 41 1b c0 	cmpl   $0xc01b4144,-0x18(%ebp)
c0107aee:	0f 85 7a ff ff ff    	jne    c0107a6e <check_swap+0x21>
     }
     assert(total == nr_free_pages());
c0107af4:	e8 22 bf ff ff       	call   c0103a1b <nr_free_pages>
c0107af9:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107afc:	39 d0                	cmp    %edx,%eax
c0107afe:	74 24                	je     c0107b24 <check_swap+0xd7>
c0107b00:	c7 44 24 0c 4a db 10 	movl   $0xc010db4a,0xc(%esp)
c0107b07:	c0 
c0107b08:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107b0f:	c0 
c0107b10:	c7 44 24 04 be 00 00 	movl   $0xbe,0x4(%esp)
c0107b17:	00 
c0107b18:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107b1f:	e8 19 89 ff ff       	call   c010043d <__panic>
     cprintf("BEGIN check_swap: count %d, total %d\n",count,total);
c0107b24:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107b27:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107b2b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107b2e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107b32:	c7 04 24 64 db 10 c0 	movl   $0xc010db64,(%esp)
c0107b39:	e8 93 87 ff ff       	call   c01002d1 <cprintf>
     
     //now we set the phy pages env     
     struct mm_struct *mm = mm_create();
c0107b3e:	e8 ae df ff ff       	call   c0105af1 <mm_create>
c0107b43:	89 45 e4             	mov    %eax,-0x1c(%ebp)
     assert(mm != NULL);
c0107b46:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0107b4a:	75 24                	jne    c0107b70 <check_swap+0x123>
c0107b4c:	c7 44 24 0c 8a db 10 	movl   $0xc010db8a,0xc(%esp)
c0107b53:	c0 
c0107b54:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107b5b:	c0 
c0107b5c:	c7 44 24 04 c3 00 00 	movl   $0xc3,0x4(%esp)
c0107b63:	00 
c0107b64:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107b6b:	e8 cd 88 ff ff       	call   c010043d <__panic>

     extern struct mm_struct *check_mm_struct;
     assert(check_mm_struct == NULL);
c0107b70:	a1 6c 40 1b c0       	mov    0xc01b406c,%eax
c0107b75:	85 c0                	test   %eax,%eax
c0107b77:	74 24                	je     c0107b9d <check_swap+0x150>
c0107b79:	c7 44 24 0c 95 db 10 	movl   $0xc010db95,0xc(%esp)
c0107b80:	c0 
c0107b81:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107b88:	c0 
c0107b89:	c7 44 24 04 c6 00 00 	movl   $0xc6,0x4(%esp)
c0107b90:	00 
c0107b91:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107b98:	e8 a0 88 ff ff       	call   c010043d <__panic>

     check_mm_struct = mm;
c0107b9d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107ba0:	a3 6c 40 1b c0       	mov    %eax,0xc01b406c

     pde_t *pgdir = mm->pgdir = boot_pgdir;
c0107ba5:	8b 15 e0 e9 12 c0    	mov    0xc012e9e0,%edx
c0107bab:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107bae:	89 50 0c             	mov    %edx,0xc(%eax)
c0107bb1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107bb4:	8b 40 0c             	mov    0xc(%eax),%eax
c0107bb7:	89 45 e0             	mov    %eax,-0x20(%ebp)
     assert(pgdir[0] == 0);
c0107bba:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107bbd:	8b 00                	mov    (%eax),%eax
c0107bbf:	85 c0                	test   %eax,%eax
c0107bc1:	74 24                	je     c0107be7 <check_swap+0x19a>
c0107bc3:	c7 44 24 0c ad db 10 	movl   $0xc010dbad,0xc(%esp)
c0107bca:	c0 
c0107bcb:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107bd2:	c0 
c0107bd3:	c7 44 24 04 cb 00 00 	movl   $0xcb,0x4(%esp)
c0107bda:	00 
c0107bdb:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107be2:	e8 56 88 ff ff       	call   c010043d <__panic>

     struct vma_struct *vma = vma_create(BEING_CHECK_VALID_VADDR, CHECK_VALID_VADDR, VM_WRITE | VM_READ);
c0107be7:	c7 44 24 08 03 00 00 	movl   $0x3,0x8(%esp)
c0107bee:	00 
c0107bef:	c7 44 24 04 00 60 00 	movl   $0x6000,0x4(%esp)
c0107bf6:	00 
c0107bf7:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
c0107bfe:	e8 8c df ff ff       	call   c0105b8f <vma_create>
c0107c03:	89 45 dc             	mov    %eax,-0x24(%ebp)
     assert(vma != NULL);
c0107c06:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0107c0a:	75 24                	jne    c0107c30 <check_swap+0x1e3>
c0107c0c:	c7 44 24 0c bb db 10 	movl   $0xc010dbbb,0xc(%esp)
c0107c13:	c0 
c0107c14:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107c1b:	c0 
c0107c1c:	c7 44 24 04 ce 00 00 	movl   $0xce,0x4(%esp)
c0107c23:	00 
c0107c24:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107c2b:	e8 0d 88 ff ff       	call   c010043d <__panic>

     insert_vma_struct(mm, vma);
c0107c30:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107c33:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107c37:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107c3a:	89 04 24             	mov    %eax,(%esp)
c0107c3d:	e8 e6 e0 ff ff       	call   c0105d28 <insert_vma_struct>

     //setup the temp Page Table vaddr 0~4MB
     cprintf("setup Page Table for vaddr 0X1000, so alloc a page\n");
c0107c42:	c7 04 24 c8 db 10 c0 	movl   $0xc010dbc8,(%esp)
c0107c49:	e8 83 86 ff ff       	call   c01002d1 <cprintf>
     pte_t *temp_ptep=NULL;
c0107c4e:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)
     temp_ptep = get_pte(mm->pgdir, BEING_CHECK_VALID_VADDR, 1);
c0107c55:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107c58:	8b 40 0c             	mov    0xc(%eax),%eax
c0107c5b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0107c62:	00 
c0107c63:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0107c6a:	00 
c0107c6b:	89 04 24             	mov    %eax,(%esp)
c0107c6e:	e8 d2 c3 ff ff       	call   c0104045 <get_pte>
c0107c73:	89 45 d8             	mov    %eax,-0x28(%ebp)
     assert(temp_ptep!= NULL);
c0107c76:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c0107c7a:	75 24                	jne    c0107ca0 <check_swap+0x253>
c0107c7c:	c7 44 24 0c fc db 10 	movl   $0xc010dbfc,0xc(%esp)
c0107c83:	c0 
c0107c84:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107c8b:	c0 
c0107c8c:	c7 44 24 04 d6 00 00 	movl   $0xd6,0x4(%esp)
c0107c93:	00 
c0107c94:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107c9b:	e8 9d 87 ff ff       	call   c010043d <__panic>
     cprintf("setup Page Table vaddr 0~4MB OVER!\n");
c0107ca0:	c7 04 24 10 dc 10 c0 	movl   $0xc010dc10,(%esp)
c0107ca7:	e8 25 86 ff ff       	call   c01002d1 <cprintf>
     
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107cac:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107cb3:	e9 a2 00 00 00       	jmp    c0107d5a <check_swap+0x30d>
          check_rp[i] = alloc_page();
c0107cb8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107cbf:	e8 b1 bc ff ff       	call   c0103975 <alloc_pages>
c0107cc4:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107cc7:	89 04 95 80 40 1b c0 	mov    %eax,-0x3fe4bf80(,%edx,4)
          assert(check_rp[i] != NULL );
c0107cce:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107cd1:	8b 04 85 80 40 1b c0 	mov    -0x3fe4bf80(,%eax,4),%eax
c0107cd8:	85 c0                	test   %eax,%eax
c0107cda:	75 24                	jne    c0107d00 <check_swap+0x2b3>
c0107cdc:	c7 44 24 0c 34 dc 10 	movl   $0xc010dc34,0xc(%esp)
c0107ce3:	c0 
c0107ce4:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107ceb:	c0 
c0107cec:	c7 44 24 04 db 00 00 	movl   $0xdb,0x4(%esp)
c0107cf3:	00 
c0107cf4:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107cfb:	e8 3d 87 ff ff       	call   c010043d <__panic>
          assert(!PageProperty(check_rp[i]));
c0107d00:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107d03:	8b 04 85 80 40 1b c0 	mov    -0x3fe4bf80(,%eax,4),%eax
c0107d0a:	83 c0 04             	add    $0x4,%eax
c0107d0d:	c7 45 b4 01 00 00 00 	movl   $0x1,-0x4c(%ebp)
c0107d14:	89 45 b0             	mov    %eax,-0x50(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0107d17:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0107d1a:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0107d1d:	0f a3 10             	bt     %edx,(%eax)
c0107d20:	19 c0                	sbb    %eax,%eax
c0107d22:	89 45 ac             	mov    %eax,-0x54(%ebp)
    return oldbit != 0;
c0107d25:	83 7d ac 00          	cmpl   $0x0,-0x54(%ebp)
c0107d29:	0f 95 c0             	setne  %al
c0107d2c:	0f b6 c0             	movzbl %al,%eax
c0107d2f:	85 c0                	test   %eax,%eax
c0107d31:	74 24                	je     c0107d57 <check_swap+0x30a>
c0107d33:	c7 44 24 0c 48 dc 10 	movl   $0xc010dc48,0xc(%esp)
c0107d3a:	c0 
c0107d3b:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107d42:	c0 
c0107d43:	c7 44 24 04 dc 00 00 	movl   $0xdc,0x4(%esp)
c0107d4a:	00 
c0107d4b:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107d52:	e8 e6 86 ff ff       	call   c010043d <__panic>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107d57:	ff 45 ec             	incl   -0x14(%ebp)
c0107d5a:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0107d5e:	0f 8e 54 ff ff ff    	jle    c0107cb8 <check_swap+0x26b>
     }
     list_entry_t free_list_store = free_list;
c0107d64:	a1 44 41 1b c0       	mov    0xc01b4144,%eax
c0107d69:	8b 15 48 41 1b c0    	mov    0xc01b4148,%edx
c0107d6f:	89 45 98             	mov    %eax,-0x68(%ebp)
c0107d72:	89 55 9c             	mov    %edx,-0x64(%ebp)
c0107d75:	c7 45 a4 44 41 1b c0 	movl   $0xc01b4144,-0x5c(%ebp)
    elm->prev = elm->next = elm;
c0107d7c:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0107d7f:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0107d82:	89 50 04             	mov    %edx,0x4(%eax)
c0107d85:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0107d88:	8b 50 04             	mov    0x4(%eax),%edx
c0107d8b:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0107d8e:	89 10                	mov    %edx,(%eax)
}
c0107d90:	90                   	nop
c0107d91:	c7 45 a8 44 41 1b c0 	movl   $0xc01b4144,-0x58(%ebp)
    return list->next == list;
c0107d98:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0107d9b:	8b 40 04             	mov    0x4(%eax),%eax
c0107d9e:	39 45 a8             	cmp    %eax,-0x58(%ebp)
c0107da1:	0f 94 c0             	sete   %al
c0107da4:	0f b6 c0             	movzbl %al,%eax
     list_init(&free_list);
     assert(list_empty(&free_list));
c0107da7:	85 c0                	test   %eax,%eax
c0107da9:	75 24                	jne    c0107dcf <check_swap+0x382>
c0107dab:	c7 44 24 0c 63 dc 10 	movl   $0xc010dc63,0xc(%esp)
c0107db2:	c0 
c0107db3:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107dba:	c0 
c0107dbb:	c7 44 24 04 e0 00 00 	movl   $0xe0,0x4(%esp)
c0107dc2:	00 
c0107dc3:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107dca:	e8 6e 86 ff ff       	call   c010043d <__panic>
     
     //assert(alloc_page() == NULL);
     
     unsigned int nr_free_store = nr_free;
c0107dcf:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c0107dd4:	89 45 d4             	mov    %eax,-0x2c(%ebp)
     nr_free = 0;
c0107dd7:	c7 05 4c 41 1b c0 00 	movl   $0x0,0xc01b414c
c0107dde:	00 00 00 
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107de1:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107de8:	eb 1d                	jmp    c0107e07 <check_swap+0x3ba>
        free_pages(check_rp[i],1);
c0107dea:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107ded:	8b 04 85 80 40 1b c0 	mov    -0x3fe4bf80(,%eax,4),%eax
c0107df4:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107dfb:	00 
c0107dfc:	89 04 24             	mov    %eax,(%esp)
c0107dff:	e8 e0 bb ff ff       	call   c01039e4 <free_pages>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107e04:	ff 45 ec             	incl   -0x14(%ebp)
c0107e07:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0107e0b:	7e dd                	jle    c0107dea <check_swap+0x39d>
     }
     assert(nr_free==CHECK_VALID_PHY_PAGE_NUM);
c0107e0d:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c0107e12:	83 f8 04             	cmp    $0x4,%eax
c0107e15:	74 24                	je     c0107e3b <check_swap+0x3ee>
c0107e17:	c7 44 24 0c 7c dc 10 	movl   $0xc010dc7c,0xc(%esp)
c0107e1e:	c0 
c0107e1f:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107e26:	c0 
c0107e27:	c7 44 24 04 e9 00 00 	movl   $0xe9,0x4(%esp)
c0107e2e:	00 
c0107e2f:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107e36:	e8 02 86 ff ff       	call   c010043d <__panic>
     
     cprintf("set up init env for check_swap begin!\n");
c0107e3b:	c7 04 24 a0 dc 10 c0 	movl   $0xc010dca0,(%esp)
c0107e42:	e8 8a 84 ff ff       	call   c01002d1 <cprintf>
     //setup initial vir_page<->phy_page environment for page relpacement algorithm 

     
     pgfault_num=0;
c0107e47:	c7 05 0c 20 1b c0 00 	movl   $0x0,0xc01b200c
c0107e4e:	00 00 00 
     
     check_content_set();
c0107e51:	e8 26 fa ff ff       	call   c010787c <check_content_set>
     assert( nr_free == 0);         
c0107e56:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c0107e5b:	85 c0                	test   %eax,%eax
c0107e5d:	74 24                	je     c0107e83 <check_swap+0x436>
c0107e5f:	c7 44 24 0c c7 dc 10 	movl   $0xc010dcc7,0xc(%esp)
c0107e66:	c0 
c0107e67:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107e6e:	c0 
c0107e6f:	c7 44 24 04 f2 00 00 	movl   $0xf2,0x4(%esp)
c0107e76:	00 
c0107e77:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107e7e:	e8 ba 85 ff ff       	call   c010043d <__panic>
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c0107e83:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107e8a:	eb 25                	jmp    c0107eb1 <check_swap+0x464>
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
c0107e8c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107e8f:	c7 04 85 a0 40 1b c0 	movl   $0xffffffff,-0x3fe4bf60(,%eax,4)
c0107e96:	ff ff ff ff 
c0107e9a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107e9d:	8b 14 85 a0 40 1b c0 	mov    -0x3fe4bf60(,%eax,4),%edx
c0107ea4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107ea7:	89 14 85 e0 40 1b c0 	mov    %edx,-0x3fe4bf20(,%eax,4)
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c0107eae:	ff 45 ec             	incl   -0x14(%ebp)
c0107eb1:	83 7d ec 09          	cmpl   $0x9,-0x14(%ebp)
c0107eb5:	7e d5                	jle    c0107e8c <check_swap+0x43f>
     
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107eb7:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107ebe:	e9 e8 00 00 00       	jmp    c0107fab <check_swap+0x55e>
         check_ptep[i]=0;
c0107ec3:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107ec6:	c7 04 85 34 41 1b c0 	movl   $0x0,-0x3fe4becc(,%eax,4)
c0107ecd:	00 00 00 00 
         check_ptep[i] = get_pte(pgdir, (i+1)*0x1000, 0);
c0107ed1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107ed4:	40                   	inc    %eax
c0107ed5:	c1 e0 0c             	shl    $0xc,%eax
c0107ed8:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107edf:	00 
c0107ee0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107ee4:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107ee7:	89 04 24             	mov    %eax,(%esp)
c0107eea:	e8 56 c1 ff ff       	call   c0104045 <get_pte>
c0107eef:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107ef2:	89 04 95 34 41 1b c0 	mov    %eax,-0x3fe4becc(,%edx,4)
         //cprintf("i %d, check_ptep addr %x, value %x\n", i, check_ptep[i], *check_ptep[i]);
         assert(check_ptep[i] != NULL);
c0107ef9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107efc:	8b 04 85 34 41 1b c0 	mov    -0x3fe4becc(,%eax,4),%eax
c0107f03:	85 c0                	test   %eax,%eax
c0107f05:	75 24                	jne    c0107f2b <check_swap+0x4de>
c0107f07:	c7 44 24 0c d4 dc 10 	movl   $0xc010dcd4,0xc(%esp)
c0107f0e:	c0 
c0107f0f:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107f16:	c0 
c0107f17:	c7 44 24 04 fa 00 00 	movl   $0xfa,0x4(%esp)
c0107f1e:	00 
c0107f1f:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107f26:	e8 12 85 ff ff       	call   c010043d <__panic>
         assert(pte2page(*check_ptep[i]) == check_rp[i]);
c0107f2b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107f2e:	8b 04 85 34 41 1b c0 	mov    -0x3fe4becc(,%eax,4),%eax
c0107f35:	8b 00                	mov    (%eax),%eax
c0107f37:	89 04 24             	mov    %eax,(%esp)
c0107f3a:	e8 73 f5 ff ff       	call   c01074b2 <pte2page>
c0107f3f:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0107f42:	8b 14 95 80 40 1b c0 	mov    -0x3fe4bf80(,%edx,4),%edx
c0107f49:	39 d0                	cmp    %edx,%eax
c0107f4b:	74 24                	je     c0107f71 <check_swap+0x524>
c0107f4d:	c7 44 24 0c ec dc 10 	movl   $0xc010dcec,0xc(%esp)
c0107f54:	c0 
c0107f55:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107f5c:	c0 
c0107f5d:	c7 44 24 04 fb 00 00 	movl   $0xfb,0x4(%esp)
c0107f64:	00 
c0107f65:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107f6c:	e8 cc 84 ff ff       	call   c010043d <__panic>
         assert((*check_ptep[i] & PTE_P));          
c0107f71:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107f74:	8b 04 85 34 41 1b c0 	mov    -0x3fe4becc(,%eax,4),%eax
c0107f7b:	8b 00                	mov    (%eax),%eax
c0107f7d:	83 e0 01             	and    $0x1,%eax
c0107f80:	85 c0                	test   %eax,%eax
c0107f82:	75 24                	jne    c0107fa8 <check_swap+0x55b>
c0107f84:	c7 44 24 0c 14 dd 10 	movl   $0xc010dd14,0xc(%esp)
c0107f8b:	c0 
c0107f8c:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107f93:	c0 
c0107f94:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0107f9b:	00 
c0107f9c:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107fa3:	e8 95 84 ff ff       	call   c010043d <__panic>
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107fa8:	ff 45 ec             	incl   -0x14(%ebp)
c0107fab:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0107faf:	0f 8e 0e ff ff ff    	jle    c0107ec3 <check_swap+0x476>
     }
     cprintf("set up init env for check_swap over!\n");
c0107fb5:	c7 04 24 30 dd 10 c0 	movl   $0xc010dd30,(%esp)
c0107fbc:	e8 10 83 ff ff       	call   c01002d1 <cprintf>
     // now access the virt pages to test  page relpacement algorithm 
     ret=check_content_access();
c0107fc1:	e8 6f fa ff ff       	call   c0107a35 <check_content_access>
c0107fc6:	89 45 d0             	mov    %eax,-0x30(%ebp)
     assert(ret==0);
c0107fc9:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c0107fcd:	74 24                	je     c0107ff3 <check_swap+0x5a6>
c0107fcf:	c7 44 24 0c 56 dd 10 	movl   $0xc010dd56,0xc(%esp)
c0107fd6:	c0 
c0107fd7:	c7 44 24 08 3e da 10 	movl   $0xc010da3e,0x8(%esp)
c0107fde:	c0 
c0107fdf:	c7 44 24 04 01 01 00 	movl   $0x101,0x4(%esp)
c0107fe6:	00 
c0107fe7:	c7 04 24 d8 d9 10 c0 	movl   $0xc010d9d8,(%esp)
c0107fee:	e8 4a 84 ff ff       	call   c010043d <__panic>
     
     //restore kernel mem env
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107ff3:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0107ffa:	eb 1d                	jmp    c0108019 <check_swap+0x5cc>
         free_pages(check_rp[i],1);
c0107ffc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107fff:	8b 04 85 80 40 1b c0 	mov    -0x3fe4bf80(,%eax,4),%eax
c0108006:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010800d:	00 
c010800e:	89 04 24             	mov    %eax,(%esp)
c0108011:	e8 ce b9 ff ff       	call   c01039e4 <free_pages>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0108016:	ff 45 ec             	incl   -0x14(%ebp)
c0108019:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c010801d:	7e dd                	jle    c0107ffc <check_swap+0x5af>
     } 

     //free_page(pte2page(*temp_ptep));
    free_page(pde2page(pgdir[0]));
c010801f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108022:	8b 00                	mov    (%eax),%eax
c0108024:	89 04 24             	mov    %eax,(%esp)
c0108027:	e8 c4 f4 ff ff       	call   c01074f0 <pde2page>
c010802c:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108033:	00 
c0108034:	89 04 24             	mov    %eax,(%esp)
c0108037:	e8 a8 b9 ff ff       	call   c01039e4 <free_pages>
     pgdir[0] = 0;
c010803c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010803f:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
     mm->pgdir = NULL;
c0108045:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108048:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
     mm_destroy(mm);
c010804f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108052:	89 04 24             	mov    %eax,(%esp)
c0108055:	e8 06 de ff ff       	call   c0105e60 <mm_destroy>
     check_mm_struct = NULL;
c010805a:	c7 05 6c 40 1b c0 00 	movl   $0x0,0xc01b406c
c0108061:	00 00 00 
     
     nr_free = nr_free_store;
c0108064:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0108067:	a3 4c 41 1b c0       	mov    %eax,0xc01b414c
     free_list = free_list_store;
c010806c:	8b 45 98             	mov    -0x68(%ebp),%eax
c010806f:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0108072:	a3 44 41 1b c0       	mov    %eax,0xc01b4144
c0108077:	89 15 48 41 1b c0    	mov    %edx,0xc01b4148

     
     le = &free_list;
c010807d:	c7 45 e8 44 41 1b c0 	movl   $0xc01b4144,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c0108084:	eb 1c                	jmp    c01080a2 <check_swap+0x655>
         struct Page *p = le2page(le, page_link);
c0108086:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108089:	83 e8 0c             	sub    $0xc,%eax
c010808c:	89 45 cc             	mov    %eax,-0x34(%ebp)
         count --, total -= p->property;
c010808f:	ff 4d f4             	decl   -0xc(%ebp)
c0108092:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108095:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0108098:	8b 40 08             	mov    0x8(%eax),%eax
c010809b:	29 c2                	sub    %eax,%edx
c010809d:	89 d0                	mov    %edx,%eax
c010809f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01080a2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01080a5:	89 45 a0             	mov    %eax,-0x60(%ebp)
    return listelm->next;
c01080a8:	8b 45 a0             	mov    -0x60(%ebp),%eax
c01080ab:	8b 40 04             	mov    0x4(%eax),%eax
     while ((le = list_next(le)) != &free_list) {
c01080ae:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01080b1:	81 7d e8 44 41 1b c0 	cmpl   $0xc01b4144,-0x18(%ebp)
c01080b8:	75 cc                	jne    c0108086 <check_swap+0x639>
     }
     cprintf("count is %d, total is %d\n",count,total);
c01080ba:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01080bd:	89 44 24 08          	mov    %eax,0x8(%esp)
c01080c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01080c4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01080c8:	c7 04 24 5d dd 10 c0 	movl   $0xc010dd5d,(%esp)
c01080cf:	e8 fd 81 ff ff       	call   c01002d1 <cprintf>
     //assert(count == 0);
     
     cprintf("check_swap() succeeded!\n");
c01080d4:	c7 04 24 77 dd 10 c0 	movl   $0xc010dd77,(%esp)
c01080db:	e8 f1 81 ff ff       	call   c01002d1 <cprintf>
}
c01080e0:	90                   	nop
c01080e1:	c9                   	leave  
c01080e2:	c3                   	ret    

c01080e3 <page2ppn>:
page2ppn(struct Page *page) {
c01080e3:	55                   	push   %ebp
c01080e4:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01080e6:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c01080eb:	8b 55 08             	mov    0x8(%ebp),%edx
c01080ee:	29 c2                	sub    %eax,%edx
c01080f0:	89 d0                	mov    %edx,%eax
c01080f2:	c1 f8 05             	sar    $0x5,%eax
}
c01080f5:	5d                   	pop    %ebp
c01080f6:	c3                   	ret    

c01080f7 <page2pa>:
page2pa(struct Page *page) {
c01080f7:	55                   	push   %ebp
c01080f8:	89 e5                	mov    %esp,%ebp
c01080fa:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01080fd:	8b 45 08             	mov    0x8(%ebp),%eax
c0108100:	89 04 24             	mov    %eax,(%esp)
c0108103:	e8 db ff ff ff       	call   c01080e3 <page2ppn>
c0108108:	c1 e0 0c             	shl    $0xc,%eax
}
c010810b:	c9                   	leave  
c010810c:	c3                   	ret    

c010810d <page_ref>:
page_ref(struct Page *page) {
c010810d:	55                   	push   %ebp
c010810e:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0108110:	8b 45 08             	mov    0x8(%ebp),%eax
c0108113:	8b 00                	mov    (%eax),%eax
}
c0108115:	5d                   	pop    %ebp
c0108116:	c3                   	ret    

c0108117 <set_page_ref>:
set_page_ref(struct Page *page, int val) {
c0108117:	55                   	push   %ebp
c0108118:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c010811a:	8b 45 08             	mov    0x8(%ebp),%eax
c010811d:	8b 55 0c             	mov    0xc(%ebp),%edx
c0108120:	89 10                	mov    %edx,(%eax)
}
c0108122:	90                   	nop
c0108123:	5d                   	pop    %ebp
c0108124:	c3                   	ret    

c0108125 <default_init>:

#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
default_init(void) {
c0108125:	f3 0f 1e fb          	endbr32 
c0108129:	55                   	push   %ebp
c010812a:	89 e5                	mov    %esp,%ebp
c010812c:	83 ec 10             	sub    $0x10,%esp
c010812f:	c7 45 fc 44 41 1b c0 	movl   $0xc01b4144,-0x4(%ebp)
    elm->prev = elm->next = elm;
c0108136:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108139:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010813c:	89 50 04             	mov    %edx,0x4(%eax)
c010813f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108142:	8b 50 04             	mov    0x4(%eax),%edx
c0108145:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108148:	89 10                	mov    %edx,(%eax)
}
c010814a:	90                   	nop
    list_init(&free_list);
    nr_free = 0;
c010814b:	c7 05 4c 41 1b c0 00 	movl   $0x0,0xc01b414c
c0108152:	00 00 00 
}
c0108155:	90                   	nop
c0108156:	c9                   	leave  
c0108157:	c3                   	ret    

c0108158 <default_init_memmap>:

static void
default_init_memmap(struct Page *base, size_t n) {
c0108158:	f3 0f 1e fb          	endbr32 
c010815c:	55                   	push   %ebp
c010815d:	89 e5                	mov    %esp,%ebp
c010815f:	83 ec 58             	sub    $0x58,%esp
    assert(n > 0);
c0108162:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0108166:	75 24                	jne    c010818c <default_init_memmap+0x34>
c0108168:	c7 44 24 0c 90 dd 10 	movl   $0xc010dd90,0xc(%esp)
c010816f:	c0 
c0108170:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108177:	c0 
c0108178:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c010817f:	00 
c0108180:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108187:	e8 b1 82 ff ff       	call   c010043d <__panic>
    struct Page *p = base;
c010818c:	8b 45 08             	mov    0x8(%ebp),%eax
c010818f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c0108192:	eb 7d                	jmp    c0108211 <default_init_memmap+0xb9>
        assert(PageReserved(p));
c0108194:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108197:	83 c0 04             	add    $0x4,%eax
c010819a:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c01081a1:	89 45 ec             	mov    %eax,-0x14(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01081a4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01081a7:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01081aa:	0f a3 10             	bt     %edx,(%eax)
c01081ad:	19 c0                	sbb    %eax,%eax
c01081af:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return oldbit != 0;
c01081b2:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01081b6:	0f 95 c0             	setne  %al
c01081b9:	0f b6 c0             	movzbl %al,%eax
c01081bc:	85 c0                	test   %eax,%eax
c01081be:	75 24                	jne    c01081e4 <default_init_memmap+0x8c>
c01081c0:	c7 44 24 0c c1 dd 10 	movl   $0xc010ddc1,0xc(%esp)
c01081c7:	c0 
c01081c8:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01081cf:	c0 
c01081d0:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c01081d7:	00 
c01081d8:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01081df:	e8 59 82 ff ff       	call   c010043d <__panic>
        p->flags = p->property = 0;
c01081e4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01081e7:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
c01081ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01081f1:	8b 50 08             	mov    0x8(%eax),%edx
c01081f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01081f7:	89 50 04             	mov    %edx,0x4(%eax)
        set_page_ref(p, 0);
c01081fa:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108201:	00 
c0108202:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108205:	89 04 24             	mov    %eax,(%esp)
c0108208:	e8 0a ff ff ff       	call   c0108117 <set_page_ref>
    for (; p != base + n; p ++) {
c010820d:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c0108211:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108214:	c1 e0 05             	shl    $0x5,%eax
c0108217:	89 c2                	mov    %eax,%edx
c0108219:	8b 45 08             	mov    0x8(%ebp),%eax
c010821c:	01 d0                	add    %edx,%eax
c010821e:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0108221:	0f 85 6d ff ff ff    	jne    c0108194 <default_init_memmap+0x3c>
    }
    base->property = n;
c0108227:	8b 45 08             	mov    0x8(%ebp),%eax
c010822a:	8b 55 0c             	mov    0xc(%ebp),%edx
c010822d:	89 50 08             	mov    %edx,0x8(%eax)
    SetPageProperty(base);
c0108230:	8b 45 08             	mov    0x8(%ebp),%eax
c0108233:	83 c0 04             	add    $0x4,%eax
c0108236:	c7 45 c8 01 00 00 00 	movl   $0x1,-0x38(%ebp)
c010823d:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0108240:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0108243:	8b 55 c8             	mov    -0x38(%ebp),%edx
c0108246:	0f ab 10             	bts    %edx,(%eax)
}
c0108249:	90                   	nop
    nr_free += n;
c010824a:	8b 15 4c 41 1b c0    	mov    0xc01b414c,%edx
c0108250:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108253:	01 d0                	add    %edx,%eax
c0108255:	a3 4c 41 1b c0       	mov    %eax,0xc01b414c
    list_add(&free_list, &(base->page_link));
c010825a:	8b 45 08             	mov    0x8(%ebp),%eax
c010825d:	83 c0 0c             	add    $0xc,%eax
c0108260:	c7 45 e4 44 41 1b c0 	movl   $0xc01b4144,-0x1c(%ebp)
c0108267:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010826a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010826d:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0108270:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108273:	89 45 d8             	mov    %eax,-0x28(%ebp)
    __list_add(elm, listelm, listelm->next);
c0108276:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108279:	8b 40 04             	mov    0x4(%eax),%eax
c010827c:	8b 55 d8             	mov    -0x28(%ebp),%edx
c010827f:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0108282:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108285:	89 55 d0             	mov    %edx,-0x30(%ebp)
c0108288:	89 45 cc             	mov    %eax,-0x34(%ebp)
    prev->next = next->prev = elm;
c010828b:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010828e:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0108291:	89 10                	mov    %edx,(%eax)
c0108293:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0108296:	8b 10                	mov    (%eax),%edx
c0108298:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010829b:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c010829e:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01082a1:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01082a4:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01082a7:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01082aa:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01082ad:	89 10                	mov    %edx,(%eax)
}
c01082af:	90                   	nop
}
c01082b0:	90                   	nop
}
c01082b1:	90                   	nop
}
c01082b2:	90                   	nop
c01082b3:	c9                   	leave  
c01082b4:	c3                   	ret    

c01082b5 <default_alloc_pages>:

static struct Page *
default_alloc_pages(size_t n) {
c01082b5:	f3 0f 1e fb          	endbr32 
c01082b9:	55                   	push   %ebp
c01082ba:	89 e5                	mov    %esp,%ebp
c01082bc:	83 ec 68             	sub    $0x68,%esp
    assert(n > 0);
c01082bf:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01082c3:	75 24                	jne    c01082e9 <default_alloc_pages+0x34>
c01082c5:	c7 44 24 0c 90 dd 10 	movl   $0xc010dd90,0xc(%esp)
c01082cc:	c0 
c01082cd:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01082d4:	c0 
c01082d5:	c7 44 24 04 7c 00 00 	movl   $0x7c,0x4(%esp)
c01082dc:	00 
c01082dd:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01082e4:	e8 54 81 ff ff       	call   c010043d <__panic>
    if (n > nr_free) {
c01082e9:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c01082ee:	39 45 08             	cmp    %eax,0x8(%ebp)
c01082f1:	76 0a                	jbe    c01082fd <default_alloc_pages+0x48>
        return NULL;
c01082f3:	b8 00 00 00 00       	mov    $0x0,%eax
c01082f8:	e9 49 01 00 00       	jmp    c0108446 <default_alloc_pages+0x191>
    }
    struct Page *page = NULL;
c01082fd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    list_entry_t *le = &free_list;
c0108304:	c7 45 f0 44 41 1b c0 	movl   $0xc01b4144,-0x10(%ebp)
    while ((le = list_next(le)) != &free_list) {
c010830b:	eb 1c                	jmp    c0108329 <default_alloc_pages+0x74>
        struct Page *p = le2page(le, page_link);
c010830d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108310:	83 e8 0c             	sub    $0xc,%eax
c0108313:	89 45 ec             	mov    %eax,-0x14(%ebp)
        if (p->property >= n) {
c0108316:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108319:	8b 40 08             	mov    0x8(%eax),%eax
c010831c:	39 45 08             	cmp    %eax,0x8(%ebp)
c010831f:	77 08                	ja     c0108329 <default_alloc_pages+0x74>
            page = p;
c0108321:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108324:	89 45 f4             	mov    %eax,-0xc(%ebp)
            break;
c0108327:	eb 18                	jmp    c0108341 <default_alloc_pages+0x8c>
c0108329:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010832c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return listelm->next;
c010832f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108332:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c0108335:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108338:	81 7d f0 44 41 1b c0 	cmpl   $0xc01b4144,-0x10(%ebp)
c010833f:	75 cc                	jne    c010830d <default_alloc_pages+0x58>
        }
    }
    if (page != NULL) {
c0108341:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108345:	0f 84 f8 00 00 00    	je     c0108443 <default_alloc_pages+0x18e>
        if (page->property > n) {
c010834b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010834e:	8b 40 08             	mov    0x8(%eax),%eax
c0108351:	39 45 08             	cmp    %eax,0x8(%ebp)
c0108354:	0f 83 95 00 00 00    	jae    c01083ef <default_alloc_pages+0x13a>
            struct Page *p = page + n;
c010835a:	8b 45 08             	mov    0x8(%ebp),%eax
c010835d:	c1 e0 05             	shl    $0x5,%eax
c0108360:	89 c2                	mov    %eax,%edx
c0108362:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108365:	01 d0                	add    %edx,%eax
c0108367:	89 45 e8             	mov    %eax,-0x18(%ebp)
            p->property = page->property - n;
c010836a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010836d:	8b 40 08             	mov    0x8(%eax),%eax
c0108370:	2b 45 08             	sub    0x8(%ebp),%eax
c0108373:	89 c2                	mov    %eax,%edx
c0108375:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108378:	89 50 08             	mov    %edx,0x8(%eax)
            SetPageProperty(p);
c010837b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010837e:	83 c0 04             	add    $0x4,%eax
c0108381:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c0108388:	89 45 c0             	mov    %eax,-0x40(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c010838b:	8b 45 c0             	mov    -0x40(%ebp),%eax
c010838e:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0108391:	0f ab 10             	bts    %edx,(%eax)
}
c0108394:	90                   	nop
            list_add(&(page->page_link), &(p->page_link));
c0108395:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108398:	83 c0 0c             	add    $0xc,%eax
c010839b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010839e:	83 c2 0c             	add    $0xc,%edx
c01083a1:	89 55 e0             	mov    %edx,-0x20(%ebp)
c01083a4:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01083a7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01083aa:	89 45 d8             	mov    %eax,-0x28(%ebp)
c01083ad:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01083b0:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    __list_add(elm, listelm, listelm->next);
c01083b3:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01083b6:	8b 40 04             	mov    0x4(%eax),%eax
c01083b9:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01083bc:	89 55 d0             	mov    %edx,-0x30(%ebp)
c01083bf:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01083c2:	89 55 cc             	mov    %edx,-0x34(%ebp)
c01083c5:	89 45 c8             	mov    %eax,-0x38(%ebp)
    prev->next = next->prev = elm;
c01083c8:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01083cb:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01083ce:	89 10                	mov    %edx,(%eax)
c01083d0:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01083d3:	8b 10                	mov    (%eax),%edx
c01083d5:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01083d8:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01083db:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01083de:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01083e1:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01083e4:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01083e7:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01083ea:	89 10                	mov    %edx,(%eax)
}
c01083ec:	90                   	nop
}
c01083ed:	90                   	nop
}
c01083ee:	90                   	nop
        }
        list_del(&(page->page_link));
c01083ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01083f2:	83 c0 0c             	add    $0xc,%eax
c01083f5:	89 45 b4             	mov    %eax,-0x4c(%ebp)
    __list_del(listelm->prev, listelm->next);
c01083f8:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01083fb:	8b 40 04             	mov    0x4(%eax),%eax
c01083fe:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0108401:	8b 12                	mov    (%edx),%edx
c0108403:	89 55 b0             	mov    %edx,-0x50(%ebp)
c0108406:	89 45 ac             	mov    %eax,-0x54(%ebp)
    prev->next = next;
c0108409:	8b 45 b0             	mov    -0x50(%ebp),%eax
c010840c:	8b 55 ac             	mov    -0x54(%ebp),%edx
c010840f:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0108412:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0108415:	8b 55 b0             	mov    -0x50(%ebp),%edx
c0108418:	89 10                	mov    %edx,(%eax)
}
c010841a:	90                   	nop
}
c010841b:	90                   	nop
        nr_free -= n;
c010841c:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c0108421:	2b 45 08             	sub    0x8(%ebp),%eax
c0108424:	a3 4c 41 1b c0       	mov    %eax,0xc01b414c
        ClearPageProperty(page);
c0108429:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010842c:	83 c0 04             	add    $0x4,%eax
c010842f:	c7 45 bc 01 00 00 00 	movl   $0x1,-0x44(%ebp)
c0108436:	89 45 b8             	mov    %eax,-0x48(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0108439:	8b 45 b8             	mov    -0x48(%ebp),%eax
c010843c:	8b 55 bc             	mov    -0x44(%ebp),%edx
c010843f:	0f b3 10             	btr    %edx,(%eax)
}
c0108442:	90                   	nop
    }
    return page;
c0108443:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0108446:	c9                   	leave  
c0108447:	c3                   	ret    

c0108448 <default_free_pages>:

static void
default_free_pages(struct Page *base, size_t n) {
c0108448:	f3 0f 1e fb          	endbr32 
c010844c:	55                   	push   %ebp
c010844d:	89 e5                	mov    %esp,%ebp
c010844f:	81 ec 98 00 00 00    	sub    $0x98,%esp
    assert(n > 0);
c0108455:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0108459:	75 24                	jne    c010847f <default_free_pages+0x37>
c010845b:	c7 44 24 0c 90 dd 10 	movl   $0xc010dd90,0xc(%esp)
c0108462:	c0 
c0108463:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010846a:	c0 
c010846b:	c7 44 24 04 99 00 00 	movl   $0x99,0x4(%esp)
c0108472:	00 
c0108473:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c010847a:	e8 be 7f ff ff       	call   c010043d <__panic>
    struct Page *p = base;
c010847f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108482:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c0108485:	e9 9d 00 00 00       	jmp    c0108527 <default_free_pages+0xdf>
        assert(!PageReserved(p) && !PageProperty(p));
c010848a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010848d:	83 c0 04             	add    $0x4,%eax
c0108490:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0108497:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010849a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010849d:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01084a0:	0f a3 10             	bt     %edx,(%eax)
c01084a3:	19 c0                	sbb    %eax,%eax
c01084a5:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return oldbit != 0;
c01084a8:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01084ac:	0f 95 c0             	setne  %al
c01084af:	0f b6 c0             	movzbl %al,%eax
c01084b2:	85 c0                	test   %eax,%eax
c01084b4:	75 2c                	jne    c01084e2 <default_free_pages+0x9a>
c01084b6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084b9:	83 c0 04             	add    $0x4,%eax
c01084bc:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
c01084c3:	89 45 dc             	mov    %eax,-0x24(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01084c6:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01084c9:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01084cc:	0f a3 10             	bt     %edx,(%eax)
c01084cf:	19 c0                	sbb    %eax,%eax
c01084d1:	89 45 d8             	mov    %eax,-0x28(%ebp)
    return oldbit != 0;
c01084d4:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c01084d8:	0f 95 c0             	setne  %al
c01084db:	0f b6 c0             	movzbl %al,%eax
c01084de:	85 c0                	test   %eax,%eax
c01084e0:	74 24                	je     c0108506 <default_free_pages+0xbe>
c01084e2:	c7 44 24 0c d4 dd 10 	movl   $0xc010ddd4,0xc(%esp)
c01084e9:	c0 
c01084ea:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01084f1:	c0 
c01084f2:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
c01084f9:	00 
c01084fa:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108501:	e8 37 7f ff ff       	call   c010043d <__panic>
        p->flags = 0;
c0108506:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108509:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
        set_page_ref(p, 0);
c0108510:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108517:	00 
c0108518:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010851b:	89 04 24             	mov    %eax,(%esp)
c010851e:	e8 f4 fb ff ff       	call   c0108117 <set_page_ref>
    for (; p != base + n; p ++) {
c0108523:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c0108527:	8b 45 0c             	mov    0xc(%ebp),%eax
c010852a:	c1 e0 05             	shl    $0x5,%eax
c010852d:	89 c2                	mov    %eax,%edx
c010852f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108532:	01 d0                	add    %edx,%eax
c0108534:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0108537:	0f 85 4d ff ff ff    	jne    c010848a <default_free_pages+0x42>
    }
    base->property = n;
c010853d:	8b 45 08             	mov    0x8(%ebp),%eax
c0108540:	8b 55 0c             	mov    0xc(%ebp),%edx
c0108543:	89 50 08             	mov    %edx,0x8(%eax)
    SetPageProperty(base);
c0108546:	8b 45 08             	mov    0x8(%ebp),%eax
c0108549:	83 c0 04             	add    $0x4,%eax
c010854c:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0108553:	89 45 cc             	mov    %eax,-0x34(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0108556:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0108559:	8b 55 d0             	mov    -0x30(%ebp),%edx
c010855c:	0f ab 10             	bts    %edx,(%eax)
}
c010855f:	90                   	nop
c0108560:	c7 45 d4 44 41 1b c0 	movl   $0xc01b4144,-0x2c(%ebp)
    return listelm->next;
c0108567:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010856a:	8b 40 04             	mov    0x4(%eax),%eax
    list_entry_t *le = list_next(&free_list);
c010856d:	89 45 f0             	mov    %eax,-0x10(%ebp)
    while (le != &free_list) {
c0108570:	e9 00 01 00 00       	jmp    c0108675 <default_free_pages+0x22d>
        p = le2page(le, page_link);
c0108575:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108578:	83 e8 0c             	sub    $0xc,%eax
c010857b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010857e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108581:	89 45 c8             	mov    %eax,-0x38(%ebp)
c0108584:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0108587:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c010858a:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (base + base->property == p) {
c010858d:	8b 45 08             	mov    0x8(%ebp),%eax
c0108590:	8b 40 08             	mov    0x8(%eax),%eax
c0108593:	c1 e0 05             	shl    $0x5,%eax
c0108596:	89 c2                	mov    %eax,%edx
c0108598:	8b 45 08             	mov    0x8(%ebp),%eax
c010859b:	01 d0                	add    %edx,%eax
c010859d:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c01085a0:	75 5d                	jne    c01085ff <default_free_pages+0x1b7>
            base->property += p->property;
c01085a2:	8b 45 08             	mov    0x8(%ebp),%eax
c01085a5:	8b 50 08             	mov    0x8(%eax),%edx
c01085a8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01085ab:	8b 40 08             	mov    0x8(%eax),%eax
c01085ae:	01 c2                	add    %eax,%edx
c01085b0:	8b 45 08             	mov    0x8(%ebp),%eax
c01085b3:	89 50 08             	mov    %edx,0x8(%eax)
            ClearPageProperty(p);
c01085b6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01085b9:	83 c0 04             	add    $0x4,%eax
c01085bc:	c7 45 b8 01 00 00 00 	movl   $0x1,-0x48(%ebp)
c01085c3:	89 45 b4             	mov    %eax,-0x4c(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01085c6:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01085c9:	8b 55 b8             	mov    -0x48(%ebp),%edx
c01085cc:	0f b3 10             	btr    %edx,(%eax)
}
c01085cf:	90                   	nop
            list_del(&(p->page_link));
c01085d0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01085d3:	83 c0 0c             	add    $0xc,%eax
c01085d6:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    __list_del(listelm->prev, listelm->next);
c01085d9:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01085dc:	8b 40 04             	mov    0x4(%eax),%eax
c01085df:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c01085e2:	8b 12                	mov    (%edx),%edx
c01085e4:	89 55 c0             	mov    %edx,-0x40(%ebp)
c01085e7:	89 45 bc             	mov    %eax,-0x44(%ebp)
    prev->next = next;
c01085ea:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01085ed:	8b 55 bc             	mov    -0x44(%ebp),%edx
c01085f0:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c01085f3:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01085f6:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01085f9:	89 10                	mov    %edx,(%eax)
}
c01085fb:	90                   	nop
}
c01085fc:	90                   	nop
c01085fd:	eb 76                	jmp    c0108675 <default_free_pages+0x22d>
        }
        else if (p + p->property == base) {
c01085ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108602:	8b 40 08             	mov    0x8(%eax),%eax
c0108605:	c1 e0 05             	shl    $0x5,%eax
c0108608:	89 c2                	mov    %eax,%edx
c010860a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010860d:	01 d0                	add    %edx,%eax
c010860f:	39 45 08             	cmp    %eax,0x8(%ebp)
c0108612:	75 61                	jne    c0108675 <default_free_pages+0x22d>
            p->property += base->property;
c0108614:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108617:	8b 50 08             	mov    0x8(%eax),%edx
c010861a:	8b 45 08             	mov    0x8(%ebp),%eax
c010861d:	8b 40 08             	mov    0x8(%eax),%eax
c0108620:	01 c2                	add    %eax,%edx
c0108622:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108625:	89 50 08             	mov    %edx,0x8(%eax)
            ClearPageProperty(base);
c0108628:	8b 45 08             	mov    0x8(%ebp),%eax
c010862b:	83 c0 04             	add    $0x4,%eax
c010862e:	c7 45 a4 01 00 00 00 	movl   $0x1,-0x5c(%ebp)
c0108635:	89 45 a0             	mov    %eax,-0x60(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0108638:	8b 45 a0             	mov    -0x60(%ebp),%eax
c010863b:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c010863e:	0f b3 10             	btr    %edx,(%eax)
}
c0108641:	90                   	nop
            base = p;
c0108642:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108645:	89 45 08             	mov    %eax,0x8(%ebp)
            list_del(&(p->page_link));
c0108648:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010864b:	83 c0 0c             	add    $0xc,%eax
c010864e:	89 45 b0             	mov    %eax,-0x50(%ebp)
    __list_del(listelm->prev, listelm->next);
c0108651:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0108654:	8b 40 04             	mov    0x4(%eax),%eax
c0108657:	8b 55 b0             	mov    -0x50(%ebp),%edx
c010865a:	8b 12                	mov    (%edx),%edx
c010865c:	89 55 ac             	mov    %edx,-0x54(%ebp)
c010865f:	89 45 a8             	mov    %eax,-0x58(%ebp)
    prev->next = next;
c0108662:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0108665:	8b 55 a8             	mov    -0x58(%ebp),%edx
c0108668:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c010866b:	8b 45 a8             	mov    -0x58(%ebp),%eax
c010866e:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0108671:	89 10                	mov    %edx,(%eax)
}
c0108673:	90                   	nop
}
c0108674:	90                   	nop
    while (le != &free_list) {
c0108675:	81 7d f0 44 41 1b c0 	cmpl   $0xc01b4144,-0x10(%ebp)
c010867c:	0f 85 f3 fe ff ff    	jne    c0108575 <default_free_pages+0x12d>
        }
    }
    nr_free += n;
c0108682:	8b 15 4c 41 1b c0    	mov    0xc01b414c,%edx
c0108688:	8b 45 0c             	mov    0xc(%ebp),%eax
c010868b:	01 d0                	add    %edx,%eax
c010868d:	a3 4c 41 1b c0       	mov    %eax,0xc01b414c
c0108692:	c7 45 9c 44 41 1b c0 	movl   $0xc01b4144,-0x64(%ebp)
    return listelm->next;
c0108699:	8b 45 9c             	mov    -0x64(%ebp),%eax
c010869c:	8b 40 04             	mov    0x4(%eax),%eax
    le = list_next(&free_list);
c010869f:	89 45 f0             	mov    %eax,-0x10(%ebp)
    while (le != &free_list) {
c01086a2:	eb 20                	jmp    c01086c4 <default_free_pages+0x27c>
        p = le2page(le, page_link);
c01086a4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01086a7:	83 e8 0c             	sub    $0xc,%eax
c01086aa:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01086ad:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01086b0:	89 45 98             	mov    %eax,-0x68(%ebp)
c01086b3:	8b 45 98             	mov    -0x68(%ebp),%eax
c01086b6:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c01086b9:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if(p>base) break;
c01086bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01086bf:	3b 45 08             	cmp    0x8(%ebp),%eax
c01086c2:	77 0b                	ja     c01086cf <default_free_pages+0x287>
    while (le != &free_list) {
c01086c4:	81 7d f0 44 41 1b c0 	cmpl   $0xc01b4144,-0x10(%ebp)
c01086cb:	75 d7                	jne    c01086a4 <default_free_pages+0x25c>
c01086cd:	eb 01                	jmp    c01086d0 <default_free_pages+0x288>
        if(p>base) break;
c01086cf:	90                   	nop
    }
    list_add_before(le,&(base->page_link));
c01086d0:	8b 45 08             	mov    0x8(%ebp),%eax
c01086d3:	8d 50 0c             	lea    0xc(%eax),%edx
c01086d6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01086d9:	89 45 94             	mov    %eax,-0x6c(%ebp)
c01086dc:	89 55 90             	mov    %edx,-0x70(%ebp)
    __list_add(elm, listelm->prev, listelm);
c01086df:	8b 45 94             	mov    -0x6c(%ebp),%eax
c01086e2:	8b 00                	mov    (%eax),%eax
c01086e4:	8b 55 90             	mov    -0x70(%ebp),%edx
c01086e7:	89 55 8c             	mov    %edx,-0x74(%ebp)
c01086ea:	89 45 88             	mov    %eax,-0x78(%ebp)
c01086ed:	8b 45 94             	mov    -0x6c(%ebp),%eax
c01086f0:	89 45 84             	mov    %eax,-0x7c(%ebp)
    prev->next = next->prev = elm;
c01086f3:	8b 45 84             	mov    -0x7c(%ebp),%eax
c01086f6:	8b 55 8c             	mov    -0x74(%ebp),%edx
c01086f9:	89 10                	mov    %edx,(%eax)
c01086fb:	8b 45 84             	mov    -0x7c(%ebp),%eax
c01086fe:	8b 10                	mov    (%eax),%edx
c0108700:	8b 45 88             	mov    -0x78(%ebp),%eax
c0108703:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0108706:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0108709:	8b 55 84             	mov    -0x7c(%ebp),%edx
c010870c:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c010870f:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0108712:	8b 55 88             	mov    -0x78(%ebp),%edx
c0108715:	89 10                	mov    %edx,(%eax)
}
c0108717:	90                   	nop
}
c0108718:	90                   	nop
}
c0108719:	90                   	nop
c010871a:	c9                   	leave  
c010871b:	c3                   	ret    

c010871c <default_nr_free_pages>:

static size_t
default_nr_free_pages(void) {
c010871c:	f3 0f 1e fb          	endbr32 
c0108720:	55                   	push   %ebp
c0108721:	89 e5                	mov    %esp,%ebp
    return nr_free;
c0108723:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
}
c0108728:	5d                   	pop    %ebp
c0108729:	c3                   	ret    

c010872a <basic_check>:

static void
basic_check(void) {
c010872a:	f3 0f 1e fb          	endbr32 
c010872e:	55                   	push   %ebp
c010872f:	89 e5                	mov    %esp,%ebp
c0108731:	83 ec 48             	sub    $0x48,%esp
    struct Page *p0, *p1, *p2;
    p0 = p1 = p2 = NULL;
c0108734:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c010873b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010873e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108741:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108744:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert((p0 = alloc_page()) != NULL);
c0108747:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010874e:	e8 22 b2 ff ff       	call   c0103975 <alloc_pages>
c0108753:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108756:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010875a:	75 24                	jne    c0108780 <basic_check+0x56>
c010875c:	c7 44 24 0c f9 dd 10 	movl   $0xc010ddf9,0xc(%esp)
c0108763:	c0 
c0108764:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010876b:	c0 
c010876c:	c7 44 24 04 c5 00 00 	movl   $0xc5,0x4(%esp)
c0108773:	00 
c0108774:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c010877b:	e8 bd 7c ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_page()) != NULL);
c0108780:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108787:	e8 e9 b1 ff ff       	call   c0103975 <alloc_pages>
c010878c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010878f:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108793:	75 24                	jne    c01087b9 <basic_check+0x8f>
c0108795:	c7 44 24 0c 15 de 10 	movl   $0xc010de15,0xc(%esp)
c010879c:	c0 
c010879d:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01087a4:	c0 
c01087a5:	c7 44 24 04 c6 00 00 	movl   $0xc6,0x4(%esp)
c01087ac:	00 
c01087ad:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01087b4:	e8 84 7c ff ff       	call   c010043d <__panic>
    assert((p2 = alloc_page()) != NULL);
c01087b9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01087c0:	e8 b0 b1 ff ff       	call   c0103975 <alloc_pages>
c01087c5:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01087c8:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01087cc:	75 24                	jne    c01087f2 <basic_check+0xc8>
c01087ce:	c7 44 24 0c 31 de 10 	movl   $0xc010de31,0xc(%esp)
c01087d5:	c0 
c01087d6:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01087dd:	c0 
c01087de:	c7 44 24 04 c7 00 00 	movl   $0xc7,0x4(%esp)
c01087e5:	00 
c01087e6:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01087ed:	e8 4b 7c ff ff       	call   c010043d <__panic>

    assert(p0 != p1 && p0 != p2 && p1 != p2);
c01087f2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01087f5:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01087f8:	74 10                	je     c010880a <basic_check+0xe0>
c01087fa:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01087fd:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0108800:	74 08                	je     c010880a <basic_check+0xe0>
c0108802:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108805:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0108808:	75 24                	jne    c010882e <basic_check+0x104>
c010880a:	c7 44 24 0c 50 de 10 	movl   $0xc010de50,0xc(%esp)
c0108811:	c0 
c0108812:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108819:	c0 
c010881a:	c7 44 24 04 c9 00 00 	movl   $0xc9,0x4(%esp)
c0108821:	00 
c0108822:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108829:	e8 0f 7c ff ff       	call   c010043d <__panic>
    assert(page_ref(p0) == 0 && page_ref(p1) == 0 && page_ref(p2) == 0);
c010882e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108831:	89 04 24             	mov    %eax,(%esp)
c0108834:	e8 d4 f8 ff ff       	call   c010810d <page_ref>
c0108839:	85 c0                	test   %eax,%eax
c010883b:	75 1e                	jne    c010885b <basic_check+0x131>
c010883d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108840:	89 04 24             	mov    %eax,(%esp)
c0108843:	e8 c5 f8 ff ff       	call   c010810d <page_ref>
c0108848:	85 c0                	test   %eax,%eax
c010884a:	75 0f                	jne    c010885b <basic_check+0x131>
c010884c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010884f:	89 04 24             	mov    %eax,(%esp)
c0108852:	e8 b6 f8 ff ff       	call   c010810d <page_ref>
c0108857:	85 c0                	test   %eax,%eax
c0108859:	74 24                	je     c010887f <basic_check+0x155>
c010885b:	c7 44 24 0c 74 de 10 	movl   $0xc010de74,0xc(%esp)
c0108862:	c0 
c0108863:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010886a:	c0 
c010886b:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c0108872:	00 
c0108873:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c010887a:	e8 be 7b ff ff       	call   c010043d <__panic>

    assert(page2pa(p0) < npage * PGSIZE);
c010887f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108882:	89 04 24             	mov    %eax,(%esp)
c0108885:	e8 6d f8 ff ff       	call   c01080f7 <page2pa>
c010888a:	8b 15 80 1f 1b c0    	mov    0xc01b1f80,%edx
c0108890:	c1 e2 0c             	shl    $0xc,%edx
c0108893:	39 d0                	cmp    %edx,%eax
c0108895:	72 24                	jb     c01088bb <basic_check+0x191>
c0108897:	c7 44 24 0c b0 de 10 	movl   $0xc010deb0,0xc(%esp)
c010889e:	c0 
c010889f:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01088a6:	c0 
c01088a7:	c7 44 24 04 cc 00 00 	movl   $0xcc,0x4(%esp)
c01088ae:	00 
c01088af:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01088b6:	e8 82 7b ff ff       	call   c010043d <__panic>
    assert(page2pa(p1) < npage * PGSIZE);
c01088bb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01088be:	89 04 24             	mov    %eax,(%esp)
c01088c1:	e8 31 f8 ff ff       	call   c01080f7 <page2pa>
c01088c6:	8b 15 80 1f 1b c0    	mov    0xc01b1f80,%edx
c01088cc:	c1 e2 0c             	shl    $0xc,%edx
c01088cf:	39 d0                	cmp    %edx,%eax
c01088d1:	72 24                	jb     c01088f7 <basic_check+0x1cd>
c01088d3:	c7 44 24 0c cd de 10 	movl   $0xc010decd,0xc(%esp)
c01088da:	c0 
c01088db:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01088e2:	c0 
c01088e3:	c7 44 24 04 cd 00 00 	movl   $0xcd,0x4(%esp)
c01088ea:	00 
c01088eb:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01088f2:	e8 46 7b ff ff       	call   c010043d <__panic>
    assert(page2pa(p2) < npage * PGSIZE);
c01088f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088fa:	89 04 24             	mov    %eax,(%esp)
c01088fd:	e8 f5 f7 ff ff       	call   c01080f7 <page2pa>
c0108902:	8b 15 80 1f 1b c0    	mov    0xc01b1f80,%edx
c0108908:	c1 e2 0c             	shl    $0xc,%edx
c010890b:	39 d0                	cmp    %edx,%eax
c010890d:	72 24                	jb     c0108933 <basic_check+0x209>
c010890f:	c7 44 24 0c ea de 10 	movl   $0xc010deea,0xc(%esp)
c0108916:	c0 
c0108917:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010891e:	c0 
c010891f:	c7 44 24 04 ce 00 00 	movl   $0xce,0x4(%esp)
c0108926:	00 
c0108927:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c010892e:	e8 0a 7b ff ff       	call   c010043d <__panic>

    list_entry_t free_list_store = free_list;
c0108933:	a1 44 41 1b c0       	mov    0xc01b4144,%eax
c0108938:	8b 15 48 41 1b c0    	mov    0xc01b4148,%edx
c010893e:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0108941:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0108944:	c7 45 dc 44 41 1b c0 	movl   $0xc01b4144,-0x24(%ebp)
    elm->prev = elm->next = elm;
c010894b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010894e:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108951:	89 50 04             	mov    %edx,0x4(%eax)
c0108954:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108957:	8b 50 04             	mov    0x4(%eax),%edx
c010895a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010895d:	89 10                	mov    %edx,(%eax)
}
c010895f:	90                   	nop
c0108960:	c7 45 e0 44 41 1b c0 	movl   $0xc01b4144,-0x20(%ebp)
    return list->next == list;
c0108967:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010896a:	8b 40 04             	mov    0x4(%eax),%eax
c010896d:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0108970:	0f 94 c0             	sete   %al
c0108973:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0108976:	85 c0                	test   %eax,%eax
c0108978:	75 24                	jne    c010899e <basic_check+0x274>
c010897a:	c7 44 24 0c 07 df 10 	movl   $0xc010df07,0xc(%esp)
c0108981:	c0 
c0108982:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108989:	c0 
c010898a:	c7 44 24 04 d2 00 00 	movl   $0xd2,0x4(%esp)
c0108991:	00 
c0108992:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108999:	e8 9f 7a ff ff       	call   c010043d <__panic>

    unsigned int nr_free_store = nr_free;
c010899e:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c01089a3:	89 45 e8             	mov    %eax,-0x18(%ebp)
    nr_free = 0;
c01089a6:	c7 05 4c 41 1b c0 00 	movl   $0x0,0xc01b414c
c01089ad:	00 00 00 

    assert(alloc_page() == NULL);
c01089b0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01089b7:	e8 b9 af ff ff       	call   c0103975 <alloc_pages>
c01089bc:	85 c0                	test   %eax,%eax
c01089be:	74 24                	je     c01089e4 <basic_check+0x2ba>
c01089c0:	c7 44 24 0c 1e df 10 	movl   $0xc010df1e,0xc(%esp)
c01089c7:	c0 
c01089c8:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01089cf:	c0 
c01089d0:	c7 44 24 04 d7 00 00 	movl   $0xd7,0x4(%esp)
c01089d7:	00 
c01089d8:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01089df:	e8 59 7a ff ff       	call   c010043d <__panic>

    free_page(p0);
c01089e4:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01089eb:	00 
c01089ec:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01089ef:	89 04 24             	mov    %eax,(%esp)
c01089f2:	e8 ed af ff ff       	call   c01039e4 <free_pages>
    free_page(p1);
c01089f7:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01089fe:	00 
c01089ff:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108a02:	89 04 24             	mov    %eax,(%esp)
c0108a05:	e8 da af ff ff       	call   c01039e4 <free_pages>
    free_page(p2);
c0108a0a:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108a11:	00 
c0108a12:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108a15:	89 04 24             	mov    %eax,(%esp)
c0108a18:	e8 c7 af ff ff       	call   c01039e4 <free_pages>
    assert(nr_free == 3);
c0108a1d:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c0108a22:	83 f8 03             	cmp    $0x3,%eax
c0108a25:	74 24                	je     c0108a4b <basic_check+0x321>
c0108a27:	c7 44 24 0c 33 df 10 	movl   $0xc010df33,0xc(%esp)
c0108a2e:	c0 
c0108a2f:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108a36:	c0 
c0108a37:	c7 44 24 04 dc 00 00 	movl   $0xdc,0x4(%esp)
c0108a3e:	00 
c0108a3f:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108a46:	e8 f2 79 ff ff       	call   c010043d <__panic>

    assert((p0 = alloc_page()) != NULL);
c0108a4b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108a52:	e8 1e af ff ff       	call   c0103975 <alloc_pages>
c0108a57:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108a5a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0108a5e:	75 24                	jne    c0108a84 <basic_check+0x35a>
c0108a60:	c7 44 24 0c f9 dd 10 	movl   $0xc010ddf9,0xc(%esp)
c0108a67:	c0 
c0108a68:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108a6f:	c0 
c0108a70:	c7 44 24 04 de 00 00 	movl   $0xde,0x4(%esp)
c0108a77:	00 
c0108a78:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108a7f:	e8 b9 79 ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_page()) != NULL);
c0108a84:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108a8b:	e8 e5 ae ff ff       	call   c0103975 <alloc_pages>
c0108a90:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108a93:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108a97:	75 24                	jne    c0108abd <basic_check+0x393>
c0108a99:	c7 44 24 0c 15 de 10 	movl   $0xc010de15,0xc(%esp)
c0108aa0:	c0 
c0108aa1:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108aa8:	c0 
c0108aa9:	c7 44 24 04 df 00 00 	movl   $0xdf,0x4(%esp)
c0108ab0:	00 
c0108ab1:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108ab8:	e8 80 79 ff ff       	call   c010043d <__panic>
    assert((p2 = alloc_page()) != NULL);
c0108abd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108ac4:	e8 ac ae ff ff       	call   c0103975 <alloc_pages>
c0108ac9:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108acc:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108ad0:	75 24                	jne    c0108af6 <basic_check+0x3cc>
c0108ad2:	c7 44 24 0c 31 de 10 	movl   $0xc010de31,0xc(%esp)
c0108ad9:	c0 
c0108ada:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108ae1:	c0 
c0108ae2:	c7 44 24 04 e0 00 00 	movl   $0xe0,0x4(%esp)
c0108ae9:	00 
c0108aea:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108af1:	e8 47 79 ff ff       	call   c010043d <__panic>

    assert(alloc_page() == NULL);
c0108af6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108afd:	e8 73 ae ff ff       	call   c0103975 <alloc_pages>
c0108b02:	85 c0                	test   %eax,%eax
c0108b04:	74 24                	je     c0108b2a <basic_check+0x400>
c0108b06:	c7 44 24 0c 1e df 10 	movl   $0xc010df1e,0xc(%esp)
c0108b0d:	c0 
c0108b0e:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108b15:	c0 
c0108b16:	c7 44 24 04 e2 00 00 	movl   $0xe2,0x4(%esp)
c0108b1d:	00 
c0108b1e:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108b25:	e8 13 79 ff ff       	call   c010043d <__panic>

    free_page(p0);
c0108b2a:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108b31:	00 
c0108b32:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108b35:	89 04 24             	mov    %eax,(%esp)
c0108b38:	e8 a7 ae ff ff       	call   c01039e4 <free_pages>
c0108b3d:	c7 45 d8 44 41 1b c0 	movl   $0xc01b4144,-0x28(%ebp)
c0108b44:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108b47:	8b 40 04             	mov    0x4(%eax),%eax
c0108b4a:	39 45 d8             	cmp    %eax,-0x28(%ebp)
c0108b4d:	0f 94 c0             	sete   %al
c0108b50:	0f b6 c0             	movzbl %al,%eax
    assert(!list_empty(&free_list));
c0108b53:	85 c0                	test   %eax,%eax
c0108b55:	74 24                	je     c0108b7b <basic_check+0x451>
c0108b57:	c7 44 24 0c 40 df 10 	movl   $0xc010df40,0xc(%esp)
c0108b5e:	c0 
c0108b5f:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108b66:	c0 
c0108b67:	c7 44 24 04 e5 00 00 	movl   $0xe5,0x4(%esp)
c0108b6e:	00 
c0108b6f:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108b76:	e8 c2 78 ff ff       	call   c010043d <__panic>

    struct Page *p;
    assert((p = alloc_page()) == p0);
c0108b7b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108b82:	e8 ee ad ff ff       	call   c0103975 <alloc_pages>
c0108b87:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0108b8a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108b8d:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0108b90:	74 24                	je     c0108bb6 <basic_check+0x48c>
c0108b92:	c7 44 24 0c 58 df 10 	movl   $0xc010df58,0xc(%esp)
c0108b99:	c0 
c0108b9a:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108ba1:	c0 
c0108ba2:	c7 44 24 04 e8 00 00 	movl   $0xe8,0x4(%esp)
c0108ba9:	00 
c0108baa:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108bb1:	e8 87 78 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c0108bb6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108bbd:	e8 b3 ad ff ff       	call   c0103975 <alloc_pages>
c0108bc2:	85 c0                	test   %eax,%eax
c0108bc4:	74 24                	je     c0108bea <basic_check+0x4c0>
c0108bc6:	c7 44 24 0c 1e df 10 	movl   $0xc010df1e,0xc(%esp)
c0108bcd:	c0 
c0108bce:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108bd5:	c0 
c0108bd6:	c7 44 24 04 e9 00 00 	movl   $0xe9,0x4(%esp)
c0108bdd:	00 
c0108bde:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108be5:	e8 53 78 ff ff       	call   c010043d <__panic>

    assert(nr_free == 0);
c0108bea:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c0108bef:	85 c0                	test   %eax,%eax
c0108bf1:	74 24                	je     c0108c17 <basic_check+0x4ed>
c0108bf3:	c7 44 24 0c 71 df 10 	movl   $0xc010df71,0xc(%esp)
c0108bfa:	c0 
c0108bfb:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108c02:	c0 
c0108c03:	c7 44 24 04 eb 00 00 	movl   $0xeb,0x4(%esp)
c0108c0a:	00 
c0108c0b:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108c12:	e8 26 78 ff ff       	call   c010043d <__panic>
    free_list = free_list_store;
c0108c17:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0108c1a:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0108c1d:	a3 44 41 1b c0       	mov    %eax,0xc01b4144
c0108c22:	89 15 48 41 1b c0    	mov    %edx,0xc01b4148
    nr_free = nr_free_store;
c0108c28:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108c2b:	a3 4c 41 1b c0       	mov    %eax,0xc01b414c

    free_page(p);
c0108c30:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108c37:	00 
c0108c38:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108c3b:	89 04 24             	mov    %eax,(%esp)
c0108c3e:	e8 a1 ad ff ff       	call   c01039e4 <free_pages>
    free_page(p1);
c0108c43:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108c4a:	00 
c0108c4b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108c4e:	89 04 24             	mov    %eax,(%esp)
c0108c51:	e8 8e ad ff ff       	call   c01039e4 <free_pages>
    free_page(p2);
c0108c56:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108c5d:	00 
c0108c5e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108c61:	89 04 24             	mov    %eax,(%esp)
c0108c64:	e8 7b ad ff ff       	call   c01039e4 <free_pages>
}
c0108c69:	90                   	nop
c0108c6a:	c9                   	leave  
c0108c6b:	c3                   	ret    

c0108c6c <default_check>:

// LAB2: below code is used to check the first fit allocation algorithm (your EXERCISE 1) 
// NOTICE: You SHOULD NOT CHANGE basic_check, default_check functions!
static void
default_check(void) {
c0108c6c:	f3 0f 1e fb          	endbr32 
c0108c70:	55                   	push   %ebp
c0108c71:	89 e5                	mov    %esp,%ebp
c0108c73:	81 ec 98 00 00 00    	sub    $0x98,%esp
    int count = 0, total = 0;
c0108c79:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0108c80:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    list_entry_t *le = &free_list;
c0108c87:	c7 45 ec 44 41 1b c0 	movl   $0xc01b4144,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c0108c8e:	eb 6a                	jmp    c0108cfa <default_check+0x8e>
        struct Page *p = le2page(le, page_link);
c0108c90:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108c93:	83 e8 0c             	sub    $0xc,%eax
c0108c96:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(PageProperty(p));
c0108c99:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0108c9c:	83 c0 04             	add    $0x4,%eax
c0108c9f:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0108ca6:	89 45 cc             	mov    %eax,-0x34(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0108ca9:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0108cac:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0108caf:	0f a3 10             	bt     %edx,(%eax)
c0108cb2:	19 c0                	sbb    %eax,%eax
c0108cb4:	89 45 c8             	mov    %eax,-0x38(%ebp)
    return oldbit != 0;
c0108cb7:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c0108cbb:	0f 95 c0             	setne  %al
c0108cbe:	0f b6 c0             	movzbl %al,%eax
c0108cc1:	85 c0                	test   %eax,%eax
c0108cc3:	75 24                	jne    c0108ce9 <default_check+0x7d>
c0108cc5:	c7 44 24 0c 7e df 10 	movl   $0xc010df7e,0xc(%esp)
c0108ccc:	c0 
c0108ccd:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108cd4:	c0 
c0108cd5:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0108cdc:	00 
c0108cdd:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108ce4:	e8 54 77 ff ff       	call   c010043d <__panic>
        count ++, total += p->property;
c0108ce9:	ff 45 f4             	incl   -0xc(%ebp)
c0108cec:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0108cef:	8b 50 08             	mov    0x8(%eax),%edx
c0108cf2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108cf5:	01 d0                	add    %edx,%eax
c0108cf7:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108cfa:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108cfd:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return listelm->next;
c0108d00:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0108d03:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c0108d06:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108d09:	81 7d ec 44 41 1b c0 	cmpl   $0xc01b4144,-0x14(%ebp)
c0108d10:	0f 85 7a ff ff ff    	jne    c0108c90 <default_check+0x24>
    }
    assert(total == nr_free_pages());
c0108d16:	e8 00 ad ff ff       	call   c0103a1b <nr_free_pages>
c0108d1b:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108d1e:	39 d0                	cmp    %edx,%eax
c0108d20:	74 24                	je     c0108d46 <default_check+0xda>
c0108d22:	c7 44 24 0c 8e df 10 	movl   $0xc010df8e,0xc(%esp)
c0108d29:	c0 
c0108d2a:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108d31:	c0 
c0108d32:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
c0108d39:	00 
c0108d3a:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108d41:	e8 f7 76 ff ff       	call   c010043d <__panic>

    basic_check();
c0108d46:	e8 df f9 ff ff       	call   c010872a <basic_check>

    struct Page *p0 = alloc_pages(5), *p1, *p2;
c0108d4b:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c0108d52:	e8 1e ac ff ff       	call   c0103975 <alloc_pages>
c0108d57:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(p0 != NULL);
c0108d5a:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0108d5e:	75 24                	jne    c0108d84 <default_check+0x118>
c0108d60:	c7 44 24 0c a7 df 10 	movl   $0xc010dfa7,0xc(%esp)
c0108d67:	c0 
c0108d68:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108d6f:	c0 
c0108d70:	c7 44 24 04 04 01 00 	movl   $0x104,0x4(%esp)
c0108d77:	00 
c0108d78:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108d7f:	e8 b9 76 ff ff       	call   c010043d <__panic>
    assert(!PageProperty(p0));
c0108d84:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108d87:	83 c0 04             	add    $0x4,%eax
c0108d8a:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c0108d91:	89 45 bc             	mov    %eax,-0x44(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0108d94:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0108d97:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0108d9a:	0f a3 10             	bt     %edx,(%eax)
c0108d9d:	19 c0                	sbb    %eax,%eax
c0108d9f:	89 45 b8             	mov    %eax,-0x48(%ebp)
    return oldbit != 0;
c0108da2:	83 7d b8 00          	cmpl   $0x0,-0x48(%ebp)
c0108da6:	0f 95 c0             	setne  %al
c0108da9:	0f b6 c0             	movzbl %al,%eax
c0108dac:	85 c0                	test   %eax,%eax
c0108dae:	74 24                	je     c0108dd4 <default_check+0x168>
c0108db0:	c7 44 24 0c b2 df 10 	movl   $0xc010dfb2,0xc(%esp)
c0108db7:	c0 
c0108db8:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108dbf:	c0 
c0108dc0:	c7 44 24 04 05 01 00 	movl   $0x105,0x4(%esp)
c0108dc7:	00 
c0108dc8:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108dcf:	e8 69 76 ff ff       	call   c010043d <__panic>

    list_entry_t free_list_store = free_list;
c0108dd4:	a1 44 41 1b c0       	mov    0xc01b4144,%eax
c0108dd9:	8b 15 48 41 1b c0    	mov    0xc01b4148,%edx
c0108ddf:	89 45 80             	mov    %eax,-0x80(%ebp)
c0108de2:	89 55 84             	mov    %edx,-0x7c(%ebp)
c0108de5:	c7 45 b0 44 41 1b c0 	movl   $0xc01b4144,-0x50(%ebp)
    elm->prev = elm->next = elm;
c0108dec:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0108def:	8b 55 b0             	mov    -0x50(%ebp),%edx
c0108df2:	89 50 04             	mov    %edx,0x4(%eax)
c0108df5:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0108df8:	8b 50 04             	mov    0x4(%eax),%edx
c0108dfb:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0108dfe:	89 10                	mov    %edx,(%eax)
}
c0108e00:	90                   	nop
c0108e01:	c7 45 b4 44 41 1b c0 	movl   $0xc01b4144,-0x4c(%ebp)
    return list->next == list;
c0108e08:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0108e0b:	8b 40 04             	mov    0x4(%eax),%eax
c0108e0e:	39 45 b4             	cmp    %eax,-0x4c(%ebp)
c0108e11:	0f 94 c0             	sete   %al
c0108e14:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0108e17:	85 c0                	test   %eax,%eax
c0108e19:	75 24                	jne    c0108e3f <default_check+0x1d3>
c0108e1b:	c7 44 24 0c 07 df 10 	movl   $0xc010df07,0xc(%esp)
c0108e22:	c0 
c0108e23:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108e2a:	c0 
c0108e2b:	c7 44 24 04 09 01 00 	movl   $0x109,0x4(%esp)
c0108e32:	00 
c0108e33:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108e3a:	e8 fe 75 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c0108e3f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108e46:	e8 2a ab ff ff       	call   c0103975 <alloc_pages>
c0108e4b:	85 c0                	test   %eax,%eax
c0108e4d:	74 24                	je     c0108e73 <default_check+0x207>
c0108e4f:	c7 44 24 0c 1e df 10 	movl   $0xc010df1e,0xc(%esp)
c0108e56:	c0 
c0108e57:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108e5e:	c0 
c0108e5f:	c7 44 24 04 0a 01 00 	movl   $0x10a,0x4(%esp)
c0108e66:	00 
c0108e67:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108e6e:	e8 ca 75 ff ff       	call   c010043d <__panic>

    unsigned int nr_free_store = nr_free;
c0108e73:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c0108e78:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    nr_free = 0;
c0108e7b:	c7 05 4c 41 1b c0 00 	movl   $0x0,0xc01b414c
c0108e82:	00 00 00 

    free_pages(p0 + 2, 3);
c0108e85:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108e88:	83 c0 40             	add    $0x40,%eax
c0108e8b:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0108e92:	00 
c0108e93:	89 04 24             	mov    %eax,(%esp)
c0108e96:	e8 49 ab ff ff       	call   c01039e4 <free_pages>
    assert(alloc_pages(4) == NULL);
c0108e9b:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c0108ea2:	e8 ce aa ff ff       	call   c0103975 <alloc_pages>
c0108ea7:	85 c0                	test   %eax,%eax
c0108ea9:	74 24                	je     c0108ecf <default_check+0x263>
c0108eab:	c7 44 24 0c c4 df 10 	movl   $0xc010dfc4,0xc(%esp)
c0108eb2:	c0 
c0108eb3:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108eba:	c0 
c0108ebb:	c7 44 24 04 10 01 00 	movl   $0x110,0x4(%esp)
c0108ec2:	00 
c0108ec3:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108eca:	e8 6e 75 ff ff       	call   c010043d <__panic>
    assert(PageProperty(p0 + 2) && p0[2].property == 3);
c0108ecf:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108ed2:	83 c0 40             	add    $0x40,%eax
c0108ed5:	83 c0 04             	add    $0x4,%eax
c0108ed8:	c7 45 ac 01 00 00 00 	movl   $0x1,-0x54(%ebp)
c0108edf:	89 45 a8             	mov    %eax,-0x58(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0108ee2:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0108ee5:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0108ee8:	0f a3 10             	bt     %edx,(%eax)
c0108eeb:	19 c0                	sbb    %eax,%eax
c0108eed:	89 45 a4             	mov    %eax,-0x5c(%ebp)
    return oldbit != 0;
c0108ef0:	83 7d a4 00          	cmpl   $0x0,-0x5c(%ebp)
c0108ef4:	0f 95 c0             	setne  %al
c0108ef7:	0f b6 c0             	movzbl %al,%eax
c0108efa:	85 c0                	test   %eax,%eax
c0108efc:	74 0e                	je     c0108f0c <default_check+0x2a0>
c0108efe:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108f01:	83 c0 40             	add    $0x40,%eax
c0108f04:	8b 40 08             	mov    0x8(%eax),%eax
c0108f07:	83 f8 03             	cmp    $0x3,%eax
c0108f0a:	74 24                	je     c0108f30 <default_check+0x2c4>
c0108f0c:	c7 44 24 0c dc df 10 	movl   $0xc010dfdc,0xc(%esp)
c0108f13:	c0 
c0108f14:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108f1b:	c0 
c0108f1c:	c7 44 24 04 11 01 00 	movl   $0x111,0x4(%esp)
c0108f23:	00 
c0108f24:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108f2b:	e8 0d 75 ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_pages(3)) != NULL);
c0108f30:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
c0108f37:	e8 39 aa ff ff       	call   c0103975 <alloc_pages>
c0108f3c:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108f3f:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0108f43:	75 24                	jne    c0108f69 <default_check+0x2fd>
c0108f45:	c7 44 24 0c 08 e0 10 	movl   $0xc010e008,0xc(%esp)
c0108f4c:	c0 
c0108f4d:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108f54:	c0 
c0108f55:	c7 44 24 04 12 01 00 	movl   $0x112,0x4(%esp)
c0108f5c:	00 
c0108f5d:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108f64:	e8 d4 74 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c0108f69:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108f70:	e8 00 aa ff ff       	call   c0103975 <alloc_pages>
c0108f75:	85 c0                	test   %eax,%eax
c0108f77:	74 24                	je     c0108f9d <default_check+0x331>
c0108f79:	c7 44 24 0c 1e df 10 	movl   $0xc010df1e,0xc(%esp)
c0108f80:	c0 
c0108f81:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108f88:	c0 
c0108f89:	c7 44 24 04 13 01 00 	movl   $0x113,0x4(%esp)
c0108f90:	00 
c0108f91:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108f98:	e8 a0 74 ff ff       	call   c010043d <__panic>
    assert(p0 + 2 == p1);
c0108f9d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108fa0:	83 c0 40             	add    $0x40,%eax
c0108fa3:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0108fa6:	74 24                	je     c0108fcc <default_check+0x360>
c0108fa8:	c7 44 24 0c 26 e0 10 	movl   $0xc010e026,0xc(%esp)
c0108faf:	c0 
c0108fb0:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0108fb7:	c0 
c0108fb8:	c7 44 24 04 14 01 00 	movl   $0x114,0x4(%esp)
c0108fbf:	00 
c0108fc0:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0108fc7:	e8 71 74 ff ff       	call   c010043d <__panic>

    p2 = p0 + 1;
c0108fcc:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108fcf:	83 c0 20             	add    $0x20,%eax
c0108fd2:	89 45 dc             	mov    %eax,-0x24(%ebp)
    free_page(p0);
c0108fd5:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108fdc:	00 
c0108fdd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108fe0:	89 04 24             	mov    %eax,(%esp)
c0108fe3:	e8 fc a9 ff ff       	call   c01039e4 <free_pages>
    free_pages(p1, 3);
c0108fe8:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0108fef:	00 
c0108ff0:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108ff3:	89 04 24             	mov    %eax,(%esp)
c0108ff6:	e8 e9 a9 ff ff       	call   c01039e4 <free_pages>
    assert(PageProperty(p0) && p0->property == 1);
c0108ffb:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108ffe:	83 c0 04             	add    $0x4,%eax
c0109001:	c7 45 a0 01 00 00 00 	movl   $0x1,-0x60(%ebp)
c0109008:	89 45 9c             	mov    %eax,-0x64(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010900b:	8b 45 9c             	mov    -0x64(%ebp),%eax
c010900e:	8b 55 a0             	mov    -0x60(%ebp),%edx
c0109011:	0f a3 10             	bt     %edx,(%eax)
c0109014:	19 c0                	sbb    %eax,%eax
c0109016:	89 45 98             	mov    %eax,-0x68(%ebp)
    return oldbit != 0;
c0109019:	83 7d 98 00          	cmpl   $0x0,-0x68(%ebp)
c010901d:	0f 95 c0             	setne  %al
c0109020:	0f b6 c0             	movzbl %al,%eax
c0109023:	85 c0                	test   %eax,%eax
c0109025:	74 0b                	je     c0109032 <default_check+0x3c6>
c0109027:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010902a:	8b 40 08             	mov    0x8(%eax),%eax
c010902d:	83 f8 01             	cmp    $0x1,%eax
c0109030:	74 24                	je     c0109056 <default_check+0x3ea>
c0109032:	c7 44 24 0c 34 e0 10 	movl   $0xc010e034,0xc(%esp)
c0109039:	c0 
c010903a:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c0109041:	c0 
c0109042:	c7 44 24 04 19 01 00 	movl   $0x119,0x4(%esp)
c0109049:	00 
c010904a:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c0109051:	e8 e7 73 ff ff       	call   c010043d <__panic>
    assert(PageProperty(p1) && p1->property == 3);
c0109056:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109059:	83 c0 04             	add    $0x4,%eax
c010905c:	c7 45 94 01 00 00 00 	movl   $0x1,-0x6c(%ebp)
c0109063:	89 45 90             	mov    %eax,-0x70(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0109066:	8b 45 90             	mov    -0x70(%ebp),%eax
c0109069:	8b 55 94             	mov    -0x6c(%ebp),%edx
c010906c:	0f a3 10             	bt     %edx,(%eax)
c010906f:	19 c0                	sbb    %eax,%eax
c0109071:	89 45 8c             	mov    %eax,-0x74(%ebp)
    return oldbit != 0;
c0109074:	83 7d 8c 00          	cmpl   $0x0,-0x74(%ebp)
c0109078:	0f 95 c0             	setne  %al
c010907b:	0f b6 c0             	movzbl %al,%eax
c010907e:	85 c0                	test   %eax,%eax
c0109080:	74 0b                	je     c010908d <default_check+0x421>
c0109082:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109085:	8b 40 08             	mov    0x8(%eax),%eax
c0109088:	83 f8 03             	cmp    $0x3,%eax
c010908b:	74 24                	je     c01090b1 <default_check+0x445>
c010908d:	c7 44 24 0c 5c e0 10 	movl   $0xc010e05c,0xc(%esp)
c0109094:	c0 
c0109095:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010909c:	c0 
c010909d:	c7 44 24 04 1a 01 00 	movl   $0x11a,0x4(%esp)
c01090a4:	00 
c01090a5:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01090ac:	e8 8c 73 ff ff       	call   c010043d <__panic>

    assert((p0 = alloc_page()) == p2 - 1);
c01090b1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01090b8:	e8 b8 a8 ff ff       	call   c0103975 <alloc_pages>
c01090bd:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01090c0:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01090c3:	83 e8 20             	sub    $0x20,%eax
c01090c6:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c01090c9:	74 24                	je     c01090ef <default_check+0x483>
c01090cb:	c7 44 24 0c 82 e0 10 	movl   $0xc010e082,0xc(%esp)
c01090d2:	c0 
c01090d3:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01090da:	c0 
c01090db:	c7 44 24 04 1c 01 00 	movl   $0x11c,0x4(%esp)
c01090e2:	00 
c01090e3:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01090ea:	e8 4e 73 ff ff       	call   c010043d <__panic>
    free_page(p0);
c01090ef:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01090f6:	00 
c01090f7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01090fa:	89 04 24             	mov    %eax,(%esp)
c01090fd:	e8 e2 a8 ff ff       	call   c01039e4 <free_pages>
    assert((p0 = alloc_pages(2)) == p2 + 1);
c0109102:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c0109109:	e8 67 a8 ff ff       	call   c0103975 <alloc_pages>
c010910e:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109111:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109114:	83 c0 20             	add    $0x20,%eax
c0109117:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c010911a:	74 24                	je     c0109140 <default_check+0x4d4>
c010911c:	c7 44 24 0c a0 e0 10 	movl   $0xc010e0a0,0xc(%esp)
c0109123:	c0 
c0109124:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010912b:	c0 
c010912c:	c7 44 24 04 1e 01 00 	movl   $0x11e,0x4(%esp)
c0109133:	00 
c0109134:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c010913b:	e8 fd 72 ff ff       	call   c010043d <__panic>

    free_pages(p0, 2);
c0109140:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c0109147:	00 
c0109148:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010914b:	89 04 24             	mov    %eax,(%esp)
c010914e:	e8 91 a8 ff ff       	call   c01039e4 <free_pages>
    free_page(p2);
c0109153:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010915a:	00 
c010915b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010915e:	89 04 24             	mov    %eax,(%esp)
c0109161:	e8 7e a8 ff ff       	call   c01039e4 <free_pages>

    assert((p0 = alloc_pages(5)) != NULL);
c0109166:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c010916d:	e8 03 a8 ff ff       	call   c0103975 <alloc_pages>
c0109172:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109175:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109179:	75 24                	jne    c010919f <default_check+0x533>
c010917b:	c7 44 24 0c c0 e0 10 	movl   $0xc010e0c0,0xc(%esp)
c0109182:	c0 
c0109183:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010918a:	c0 
c010918b:	c7 44 24 04 23 01 00 	movl   $0x123,0x4(%esp)
c0109192:	00 
c0109193:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c010919a:	e8 9e 72 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c010919f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01091a6:	e8 ca a7 ff ff       	call   c0103975 <alloc_pages>
c01091ab:	85 c0                	test   %eax,%eax
c01091ad:	74 24                	je     c01091d3 <default_check+0x567>
c01091af:	c7 44 24 0c 1e df 10 	movl   $0xc010df1e,0xc(%esp)
c01091b6:	c0 
c01091b7:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01091be:	c0 
c01091bf:	c7 44 24 04 24 01 00 	movl   $0x124,0x4(%esp)
c01091c6:	00 
c01091c7:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01091ce:	e8 6a 72 ff ff       	call   c010043d <__panic>

    assert(nr_free == 0);
c01091d3:	a1 4c 41 1b c0       	mov    0xc01b414c,%eax
c01091d8:	85 c0                	test   %eax,%eax
c01091da:	74 24                	je     c0109200 <default_check+0x594>
c01091dc:	c7 44 24 0c 71 df 10 	movl   $0xc010df71,0xc(%esp)
c01091e3:	c0 
c01091e4:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01091eb:	c0 
c01091ec:	c7 44 24 04 26 01 00 	movl   $0x126,0x4(%esp)
c01091f3:	00 
c01091f4:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01091fb:	e8 3d 72 ff ff       	call   c010043d <__panic>
    nr_free = nr_free_store;
c0109200:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109203:	a3 4c 41 1b c0       	mov    %eax,0xc01b414c

    free_list = free_list_store;
c0109208:	8b 45 80             	mov    -0x80(%ebp),%eax
c010920b:	8b 55 84             	mov    -0x7c(%ebp),%edx
c010920e:	a3 44 41 1b c0       	mov    %eax,0xc01b4144
c0109213:	89 15 48 41 1b c0    	mov    %edx,0xc01b4148
    free_pages(p0, 5);
c0109219:	c7 44 24 04 05 00 00 	movl   $0x5,0x4(%esp)
c0109220:	00 
c0109221:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109224:	89 04 24             	mov    %eax,(%esp)
c0109227:	e8 b8 a7 ff ff       	call   c01039e4 <free_pages>

    le = &free_list;
c010922c:	c7 45 ec 44 41 1b c0 	movl   $0xc01b4144,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c0109233:	eb 1c                	jmp    c0109251 <default_check+0x5e5>
        struct Page *p = le2page(le, page_link);
c0109235:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109238:	83 e8 0c             	sub    $0xc,%eax
c010923b:	89 45 d8             	mov    %eax,-0x28(%ebp)
        count --, total -= p->property;
c010923e:	ff 4d f4             	decl   -0xc(%ebp)
c0109241:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109244:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0109247:	8b 40 08             	mov    0x8(%eax),%eax
c010924a:	29 c2                	sub    %eax,%edx
c010924c:	89 d0                	mov    %edx,%eax
c010924e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109251:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109254:	89 45 88             	mov    %eax,-0x78(%ebp)
    return listelm->next;
c0109257:	8b 45 88             	mov    -0x78(%ebp),%eax
c010925a:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c010925d:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109260:	81 7d ec 44 41 1b c0 	cmpl   $0xc01b4144,-0x14(%ebp)
c0109267:	75 cc                	jne    c0109235 <default_check+0x5c9>
    }
    assert(count == 0);
c0109269:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010926d:	74 24                	je     c0109293 <default_check+0x627>
c010926f:	c7 44 24 0c de e0 10 	movl   $0xc010e0de,0xc(%esp)
c0109276:	c0 
c0109277:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c010927e:	c0 
c010927f:	c7 44 24 04 31 01 00 	movl   $0x131,0x4(%esp)
c0109286:	00 
c0109287:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c010928e:	e8 aa 71 ff ff       	call   c010043d <__panic>
    assert(total == 0);
c0109293:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0109297:	74 24                	je     c01092bd <default_check+0x651>
c0109299:	c7 44 24 0c e9 e0 10 	movl   $0xc010e0e9,0xc(%esp)
c01092a0:	c0 
c01092a1:	c7 44 24 08 96 dd 10 	movl   $0xc010dd96,0x8(%esp)
c01092a8:	c0 
c01092a9:	c7 44 24 04 32 01 00 	movl   $0x132,0x4(%esp)
c01092b0:	00 
c01092b1:	c7 04 24 ab dd 10 c0 	movl   $0xc010ddab,(%esp)
c01092b8:	e8 80 71 ff ff       	call   c010043d <__panic>
}
c01092bd:	90                   	nop
c01092be:	c9                   	leave  
c01092bf:	c3                   	ret    

c01092c0 <page2ppn>:
page2ppn(struct Page *page) {
c01092c0:	55                   	push   %ebp
c01092c1:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01092c3:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c01092c8:	8b 55 08             	mov    0x8(%ebp),%edx
c01092cb:	29 c2                	sub    %eax,%edx
c01092cd:	89 d0                	mov    %edx,%eax
c01092cf:	c1 f8 05             	sar    $0x5,%eax
}
c01092d2:	5d                   	pop    %ebp
c01092d3:	c3                   	ret    

c01092d4 <page2pa>:
page2pa(struct Page *page) {
c01092d4:	55                   	push   %ebp
c01092d5:	89 e5                	mov    %esp,%ebp
c01092d7:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01092da:	8b 45 08             	mov    0x8(%ebp),%eax
c01092dd:	89 04 24             	mov    %eax,(%esp)
c01092e0:	e8 db ff ff ff       	call   c01092c0 <page2ppn>
c01092e5:	c1 e0 0c             	shl    $0xc,%eax
}
c01092e8:	c9                   	leave  
c01092e9:	c3                   	ret    

c01092ea <page2kva>:
page2kva(struct Page *page) {
c01092ea:	55                   	push   %ebp
c01092eb:	89 e5                	mov    %esp,%ebp
c01092ed:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01092f0:	8b 45 08             	mov    0x8(%ebp),%eax
c01092f3:	89 04 24             	mov    %eax,(%esp)
c01092f6:	e8 d9 ff ff ff       	call   c01092d4 <page2pa>
c01092fb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01092fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109301:	c1 e8 0c             	shr    $0xc,%eax
c0109304:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109307:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c010930c:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c010930f:	72 23                	jb     c0109334 <page2kva+0x4a>
c0109311:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109314:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109318:	c7 44 24 08 24 e1 10 	movl   $0xc010e124,0x8(%esp)
c010931f:	c0 
c0109320:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c0109327:	00 
c0109328:	c7 04 24 47 e1 10 c0 	movl   $0xc010e147,(%esp)
c010932f:	e8 09 71 ff ff       	call   c010043d <__panic>
c0109334:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109337:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c010933c:	c9                   	leave  
c010933d:	c3                   	ret    

c010933e <swapfs_init>:
#include <ide.h>
#include <pmm.h>
#include <assert.h>

void
swapfs_init(void) {
c010933e:	f3 0f 1e fb          	endbr32 
c0109342:	55                   	push   %ebp
c0109343:	89 e5                	mov    %esp,%ebp
c0109345:	83 ec 18             	sub    $0x18,%esp
    static_assert((PGSIZE % SECTSIZE) == 0);
    if (!ide_device_valid(SWAP_DEV_NO)) {
c0109348:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010934f:	e8 0d 7f ff ff       	call   c0101261 <ide_device_valid>
c0109354:	85 c0                	test   %eax,%eax
c0109356:	75 1c                	jne    c0109374 <swapfs_init+0x36>
        panic("swap fs isn't available.\n");
c0109358:	c7 44 24 08 55 e1 10 	movl   $0xc010e155,0x8(%esp)
c010935f:	c0 
c0109360:	c7 44 24 04 0d 00 00 	movl   $0xd,0x4(%esp)
c0109367:	00 
c0109368:	c7 04 24 6f e1 10 c0 	movl   $0xc010e16f,(%esp)
c010936f:	e8 c9 70 ff ff       	call   c010043d <__panic>
    }
    max_swap_offset = ide_device_size(SWAP_DEV_NO) / (PGSIZE / SECTSIZE);
c0109374:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010937b:	e8 23 7f ff ff       	call   c01012a3 <ide_device_size>
c0109380:	c1 e8 03             	shr    $0x3,%eax
c0109383:	a3 1c 41 1b c0       	mov    %eax,0xc01b411c
}
c0109388:	90                   	nop
c0109389:	c9                   	leave  
c010938a:	c3                   	ret    

c010938b <swapfs_read>:

int
swapfs_read(swap_entry_t entry, struct Page *page) {
c010938b:	f3 0f 1e fb          	endbr32 
c010938f:	55                   	push   %ebp
c0109390:	89 e5                	mov    %esp,%ebp
c0109392:	83 ec 28             	sub    $0x28,%esp
    return ide_read_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c0109395:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109398:	89 04 24             	mov    %eax,(%esp)
c010939b:	e8 4a ff ff ff       	call   c01092ea <page2kva>
c01093a0:	8b 55 08             	mov    0x8(%ebp),%edx
c01093a3:	c1 ea 08             	shr    $0x8,%edx
c01093a6:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01093a9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01093ad:	74 0b                	je     c01093ba <swapfs_read+0x2f>
c01093af:	8b 15 1c 41 1b c0    	mov    0xc01b411c,%edx
c01093b5:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c01093b8:	72 23                	jb     c01093dd <swapfs_read+0x52>
c01093ba:	8b 45 08             	mov    0x8(%ebp),%eax
c01093bd:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01093c1:	c7 44 24 08 80 e1 10 	movl   $0xc010e180,0x8(%esp)
c01093c8:	c0 
c01093c9:	c7 44 24 04 14 00 00 	movl   $0x14,0x4(%esp)
c01093d0:	00 
c01093d1:	c7 04 24 6f e1 10 c0 	movl   $0xc010e16f,(%esp)
c01093d8:	e8 60 70 ff ff       	call   c010043d <__panic>
c01093dd:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01093e0:	c1 e2 03             	shl    $0x3,%edx
c01093e3:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c01093ea:	00 
c01093eb:	89 44 24 08          	mov    %eax,0x8(%esp)
c01093ef:	89 54 24 04          	mov    %edx,0x4(%esp)
c01093f3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01093fa:	e8 e3 7e ff ff       	call   c01012e2 <ide_read_secs>
}
c01093ff:	c9                   	leave  
c0109400:	c3                   	ret    

c0109401 <swapfs_write>:

int
swapfs_write(swap_entry_t entry, struct Page *page) {
c0109401:	f3 0f 1e fb          	endbr32 
c0109405:	55                   	push   %ebp
c0109406:	89 e5                	mov    %esp,%ebp
c0109408:	83 ec 28             	sub    $0x28,%esp
    return ide_write_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c010940b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010940e:	89 04 24             	mov    %eax,(%esp)
c0109411:	e8 d4 fe ff ff       	call   c01092ea <page2kva>
c0109416:	8b 55 08             	mov    0x8(%ebp),%edx
c0109419:	c1 ea 08             	shr    $0x8,%edx
c010941c:	89 55 f4             	mov    %edx,-0xc(%ebp)
c010941f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0109423:	74 0b                	je     c0109430 <swapfs_write+0x2f>
c0109425:	8b 15 1c 41 1b c0    	mov    0xc01b411c,%edx
c010942b:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c010942e:	72 23                	jb     c0109453 <swapfs_write+0x52>
c0109430:	8b 45 08             	mov    0x8(%ebp),%eax
c0109433:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109437:	c7 44 24 08 80 e1 10 	movl   $0xc010e180,0x8(%esp)
c010943e:	c0 
c010943f:	c7 44 24 04 19 00 00 	movl   $0x19,0x4(%esp)
c0109446:	00 
c0109447:	c7 04 24 6f e1 10 c0 	movl   $0xc010e16f,(%esp)
c010944e:	e8 ea 6f ff ff       	call   c010043d <__panic>
c0109453:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109456:	c1 e2 03             	shl    $0x3,%edx
c0109459:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c0109460:	00 
c0109461:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109465:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109469:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0109470:	e8 b2 80 ff ff       	call   c0101527 <ide_write_secs>
}
c0109475:	c9                   	leave  
c0109476:	c3                   	ret    

c0109477 <switch_to>:
.text
.globl switch_to
switch_to:                      # switch_to(from, to)

    # save from's registers
    movl 4(%esp), %eax          # eax points to from
c0109477:	8b 44 24 04          	mov    0x4(%esp),%eax
    popl 0(%eax)                # save eip !popl
c010947b:	8f 00                	popl   (%eax)
    movl %esp, 4(%eax)
c010947d:	89 60 04             	mov    %esp,0x4(%eax)
    movl %ebx, 8(%eax)
c0109480:	89 58 08             	mov    %ebx,0x8(%eax)
    movl %ecx, 12(%eax)
c0109483:	89 48 0c             	mov    %ecx,0xc(%eax)
    movl %edx, 16(%eax)
c0109486:	89 50 10             	mov    %edx,0x10(%eax)
    movl %esi, 20(%eax)
c0109489:	89 70 14             	mov    %esi,0x14(%eax)
    movl %edi, 24(%eax)
c010948c:	89 78 18             	mov    %edi,0x18(%eax)
    movl %ebp, 28(%eax)
c010948f:	89 68 1c             	mov    %ebp,0x1c(%eax)

    # restore to's registers
    movl 4(%esp), %eax          # not 8(%esp): popped return address already
c0109492:	8b 44 24 04          	mov    0x4(%esp),%eax
                                # eax now points to to
    movl 28(%eax), %ebp
c0109496:	8b 68 1c             	mov    0x1c(%eax),%ebp
    movl 24(%eax), %edi
c0109499:	8b 78 18             	mov    0x18(%eax),%edi
    movl 20(%eax), %esi
c010949c:	8b 70 14             	mov    0x14(%eax),%esi
    movl 16(%eax), %edx
c010949f:	8b 50 10             	mov    0x10(%eax),%edx
    movl 12(%eax), %ecx
c01094a2:	8b 48 0c             	mov    0xc(%eax),%ecx
    movl 8(%eax), %ebx
c01094a5:	8b 58 08             	mov    0x8(%eax),%ebx
    movl 4(%eax), %esp
c01094a8:	8b 60 04             	mov    0x4(%eax),%esp

    pushl 0(%eax)               # push eip
c01094ab:	ff 30                	pushl  (%eax)

    ret
c01094ad:	c3                   	ret    

c01094ae <kernel_thread_entry>:
.text
.globl kernel_thread_entry
kernel_thread_entry:        # void kernel_thread(void)

    pushl %edx              # push arg
c01094ae:	52                   	push   %edx
    call *%ebx              # call fn
c01094af:	ff d3                	call   *%ebx

    pushl %eax              # save the return value of fn(arg)
c01094b1:	50                   	push   %eax
    call do_exit            # call do_exit to terminate current thread
c01094b2:	e8 e9 0c 00 00       	call   c010a1a0 <do_exit>

c01094b7 <test_and_set_bit>:
 * test_and_set_bit - Atomically set a bit and return its old value
 * @nr:     the bit to set
 * @addr:   the address to count from
 * */
static inline bool
test_and_set_bit(int nr, volatile void *addr) {
c01094b7:	55                   	push   %ebp
c01094b8:	89 e5                	mov    %esp,%ebp
c01094ba:	83 ec 10             	sub    $0x10,%esp
    int oldbit;
    asm volatile ("btsl %2, %1; sbbl %0, %0" : "=r" (oldbit), "=m" (*(volatile long *)addr) : "Ir" (nr) : "memory");
c01094bd:	8b 55 0c             	mov    0xc(%ebp),%edx
c01094c0:	8b 45 08             	mov    0x8(%ebp),%eax
c01094c3:	0f ab 02             	bts    %eax,(%edx)
c01094c6:	19 c0                	sbb    %eax,%eax
c01094c8:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return oldbit != 0;
c01094cb:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c01094cf:	0f 95 c0             	setne  %al
c01094d2:	0f b6 c0             	movzbl %al,%eax
}
c01094d5:	c9                   	leave  
c01094d6:	c3                   	ret    

c01094d7 <test_and_clear_bit>:
 * test_and_clear_bit - Atomically clear a bit and return its old value
 * @nr:     the bit to clear
 * @addr:   the address to count from
 * */
static inline bool
test_and_clear_bit(int nr, volatile void *addr) {
c01094d7:	55                   	push   %ebp
c01094d8:	89 e5                	mov    %esp,%ebp
c01094da:	83 ec 10             	sub    $0x10,%esp
    int oldbit;
    asm volatile ("btrl %2, %1; sbbl %0, %0" : "=r" (oldbit), "=m" (*(volatile long *)addr) : "Ir" (nr) : "memory");
c01094dd:	8b 55 0c             	mov    0xc(%ebp),%edx
c01094e0:	8b 45 08             	mov    0x8(%ebp),%eax
c01094e3:	0f b3 02             	btr    %eax,(%edx)
c01094e6:	19 c0                	sbb    %eax,%eax
c01094e8:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return oldbit != 0;
c01094eb:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c01094ef:	0f 95 c0             	setne  %al
c01094f2:	0f b6 c0             	movzbl %al,%eax
}
c01094f5:	c9                   	leave  
c01094f6:	c3                   	ret    

c01094f7 <__intr_save>:
__intr_save(void) {
c01094f7:	55                   	push   %ebp
c01094f8:	89 e5                	mov    %esp,%ebp
c01094fa:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01094fd:	9c                   	pushf  
c01094fe:	58                   	pop    %eax
c01094ff:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0109502:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0109505:	25 00 02 00 00       	and    $0x200,%eax
c010950a:	85 c0                	test   %eax,%eax
c010950c:	74 0c                	je     c010951a <__intr_save+0x23>
        intr_disable();
c010950e:	e8 e5 8d ff ff       	call   c01022f8 <intr_disable>
        return 1;
c0109513:	b8 01 00 00 00       	mov    $0x1,%eax
c0109518:	eb 05                	jmp    c010951f <__intr_save+0x28>
    return 0;
c010951a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010951f:	c9                   	leave  
c0109520:	c3                   	ret    

c0109521 <__intr_restore>:
__intr_restore(bool flag) {
c0109521:	55                   	push   %ebp
c0109522:	89 e5                	mov    %esp,%ebp
c0109524:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0109527:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010952b:	74 05                	je     c0109532 <__intr_restore+0x11>
        intr_enable();
c010952d:	e8 ba 8d ff ff       	call   c01022ec <intr_enable>
}
c0109532:	90                   	nop
c0109533:	c9                   	leave  
c0109534:	c3                   	ret    

c0109535 <try_lock>:

static inline bool
try_lock(lock_t *lock) {
c0109535:	55                   	push   %ebp
c0109536:	89 e5                	mov    %esp,%ebp
c0109538:	83 ec 08             	sub    $0x8,%esp
    return !test_and_set_bit(0, lock);
c010953b:	8b 45 08             	mov    0x8(%ebp),%eax
c010953e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109542:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0109549:	e8 69 ff ff ff       	call   c01094b7 <test_and_set_bit>
c010954e:	85 c0                	test   %eax,%eax
c0109550:	0f 94 c0             	sete   %al
c0109553:	0f b6 c0             	movzbl %al,%eax
}
c0109556:	c9                   	leave  
c0109557:	c3                   	ret    

c0109558 <lock>:

static inline void
lock(lock_t *lock) {
c0109558:	55                   	push   %ebp
c0109559:	89 e5                	mov    %esp,%ebp
c010955b:	83 ec 18             	sub    $0x18,%esp
    while (!try_lock(lock)) {
c010955e:	eb 05                	jmp    c0109565 <lock+0xd>
        schedule();
c0109560:	e8 96 1c 00 00       	call   c010b1fb <schedule>
    while (!try_lock(lock)) {
c0109565:	8b 45 08             	mov    0x8(%ebp),%eax
c0109568:	89 04 24             	mov    %eax,(%esp)
c010956b:	e8 c5 ff ff ff       	call   c0109535 <try_lock>
c0109570:	85 c0                	test   %eax,%eax
c0109572:	74 ec                	je     c0109560 <lock+0x8>
    }
}
c0109574:	90                   	nop
c0109575:	90                   	nop
c0109576:	c9                   	leave  
c0109577:	c3                   	ret    

c0109578 <unlock>:

static inline void
unlock(lock_t *lock) {
c0109578:	55                   	push   %ebp
c0109579:	89 e5                	mov    %esp,%ebp
c010957b:	83 ec 18             	sub    $0x18,%esp
    if (!test_and_clear_bit(0, lock)) {
c010957e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109581:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109585:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c010958c:	e8 46 ff ff ff       	call   c01094d7 <test_and_clear_bit>
c0109591:	85 c0                	test   %eax,%eax
c0109593:	75 1c                	jne    c01095b1 <unlock+0x39>
        panic("Unlock failed.\n");
c0109595:	c7 44 24 08 a0 e1 10 	movl   $0xc010e1a0,0x8(%esp)
c010959c:	c0 
c010959d:	c7 44 24 04 34 00 00 	movl   $0x34,0x4(%esp)
c01095a4:	00 
c01095a5:	c7 04 24 b0 e1 10 c0 	movl   $0xc010e1b0,(%esp)
c01095ac:	e8 8c 6e ff ff       	call   c010043d <__panic>
    }
}
c01095b1:	90                   	nop
c01095b2:	c9                   	leave  
c01095b3:	c3                   	ret    

c01095b4 <page2ppn>:
page2ppn(struct Page *page) {
c01095b4:	55                   	push   %ebp
c01095b5:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01095b7:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c01095bc:	8b 55 08             	mov    0x8(%ebp),%edx
c01095bf:	29 c2                	sub    %eax,%edx
c01095c1:	89 d0                	mov    %edx,%eax
c01095c3:	c1 f8 05             	sar    $0x5,%eax
}
c01095c6:	5d                   	pop    %ebp
c01095c7:	c3                   	ret    

c01095c8 <page2pa>:
page2pa(struct Page *page) {
c01095c8:	55                   	push   %ebp
c01095c9:	89 e5                	mov    %esp,%ebp
c01095cb:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01095ce:	8b 45 08             	mov    0x8(%ebp),%eax
c01095d1:	89 04 24             	mov    %eax,(%esp)
c01095d4:	e8 db ff ff ff       	call   c01095b4 <page2ppn>
c01095d9:	c1 e0 0c             	shl    $0xc,%eax
}
c01095dc:	c9                   	leave  
c01095dd:	c3                   	ret    

c01095de <pa2page>:
pa2page(uintptr_t pa) {
c01095de:	55                   	push   %ebp
c01095df:	89 e5                	mov    %esp,%ebp
c01095e1:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c01095e4:	8b 45 08             	mov    0x8(%ebp),%eax
c01095e7:	c1 e8 0c             	shr    $0xc,%eax
c01095ea:	89 c2                	mov    %eax,%edx
c01095ec:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c01095f1:	39 c2                	cmp    %eax,%edx
c01095f3:	72 1c                	jb     c0109611 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01095f5:	c7 44 24 08 c4 e1 10 	movl   $0xc010e1c4,0x8(%esp)
c01095fc:	c0 
c01095fd:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
c0109604:	00 
c0109605:	c7 04 24 e3 e1 10 c0 	movl   $0xc010e1e3,(%esp)
c010960c:	e8 2c 6e ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0109611:	a1 60 40 1b c0       	mov    0xc01b4060,%eax
c0109616:	8b 55 08             	mov    0x8(%ebp),%edx
c0109619:	c1 ea 0c             	shr    $0xc,%edx
c010961c:	c1 e2 05             	shl    $0x5,%edx
c010961f:	01 d0                	add    %edx,%eax
}
c0109621:	c9                   	leave  
c0109622:	c3                   	ret    

c0109623 <page2kva>:
page2kva(struct Page *page) {
c0109623:	55                   	push   %ebp
c0109624:	89 e5                	mov    %esp,%ebp
c0109626:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0109629:	8b 45 08             	mov    0x8(%ebp),%eax
c010962c:	89 04 24             	mov    %eax,(%esp)
c010962f:	e8 94 ff ff ff       	call   c01095c8 <page2pa>
c0109634:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109637:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010963a:	c1 e8 0c             	shr    $0xc,%eax
c010963d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109640:	a1 80 1f 1b c0       	mov    0xc01b1f80,%eax
c0109645:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0109648:	72 23                	jb     c010966d <page2kva+0x4a>
c010964a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010964d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109651:	c7 44 24 08 f4 e1 10 	movl   $0xc010e1f4,0x8(%esp)
c0109658:	c0 
c0109659:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c0109660:	00 
c0109661:	c7 04 24 e3 e1 10 c0 	movl   $0xc010e1e3,(%esp)
c0109668:	e8 d0 6d ff ff       	call   c010043d <__panic>
c010966d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109670:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0109675:	c9                   	leave  
c0109676:	c3                   	ret    

c0109677 <kva2page>:
kva2page(void *kva) {
c0109677:	55                   	push   %ebp
c0109678:	89 e5                	mov    %esp,%ebp
c010967a:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c010967d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109680:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109683:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c010968a:	77 23                	ja     c01096af <kva2page+0x38>
c010968c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010968f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109693:	c7 44 24 08 18 e2 10 	movl   $0xc010e218,0x8(%esp)
c010969a:	c0 
c010969b:	c7 44 24 04 6a 00 00 	movl   $0x6a,0x4(%esp)
c01096a2:	00 
c01096a3:	c7 04 24 e3 e1 10 c0 	movl   $0xc010e1e3,(%esp)
c01096aa:	e8 8e 6d ff ff       	call   c010043d <__panic>
c01096af:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01096b2:	05 00 00 00 40       	add    $0x40000000,%eax
c01096b7:	89 04 24             	mov    %eax,(%esp)
c01096ba:	e8 1f ff ff ff       	call   c01095de <pa2page>
}
c01096bf:	c9                   	leave  
c01096c0:	c3                   	ret    

c01096c1 <mm_count_inc>:

static inline int
mm_count_inc(struct mm_struct *mm) {
c01096c1:	55                   	push   %ebp
c01096c2:	89 e5                	mov    %esp,%ebp
    mm->mm_count += 1;
c01096c4:	8b 45 08             	mov    0x8(%ebp),%eax
c01096c7:	8b 40 18             	mov    0x18(%eax),%eax
c01096ca:	8d 50 01             	lea    0x1(%eax),%edx
c01096cd:	8b 45 08             	mov    0x8(%ebp),%eax
c01096d0:	89 50 18             	mov    %edx,0x18(%eax)
    return mm->mm_count;
c01096d3:	8b 45 08             	mov    0x8(%ebp),%eax
c01096d6:	8b 40 18             	mov    0x18(%eax),%eax
}
c01096d9:	5d                   	pop    %ebp
c01096da:	c3                   	ret    

c01096db <mm_count_dec>:

static inline int
mm_count_dec(struct mm_struct *mm) {
c01096db:	55                   	push   %ebp
c01096dc:	89 e5                	mov    %esp,%ebp
    mm->mm_count -= 1;
c01096de:	8b 45 08             	mov    0x8(%ebp),%eax
c01096e1:	8b 40 18             	mov    0x18(%eax),%eax
c01096e4:	8d 50 ff             	lea    -0x1(%eax),%edx
c01096e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01096ea:	89 50 18             	mov    %edx,0x18(%eax)
    return mm->mm_count;
c01096ed:	8b 45 08             	mov    0x8(%ebp),%eax
c01096f0:	8b 40 18             	mov    0x18(%eax),%eax
}
c01096f3:	5d                   	pop    %ebp
c01096f4:	c3                   	ret    

c01096f5 <lock_mm>:

static inline void
lock_mm(struct mm_struct *mm) {
c01096f5:	55                   	push   %ebp
c01096f6:	89 e5                	mov    %esp,%ebp
c01096f8:	83 ec 18             	sub    $0x18,%esp
    if (mm != NULL) {
c01096fb:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01096ff:	74 0e                	je     c010970f <lock_mm+0x1a>
        lock(&(mm->mm_lock));
c0109701:	8b 45 08             	mov    0x8(%ebp),%eax
c0109704:	83 c0 1c             	add    $0x1c,%eax
c0109707:	89 04 24             	mov    %eax,(%esp)
c010970a:	e8 49 fe ff ff       	call   c0109558 <lock>
    }
}
c010970f:	90                   	nop
c0109710:	c9                   	leave  
c0109711:	c3                   	ret    

c0109712 <unlock_mm>:

static inline void
unlock_mm(struct mm_struct *mm) {
c0109712:	55                   	push   %ebp
c0109713:	89 e5                	mov    %esp,%ebp
c0109715:	83 ec 18             	sub    $0x18,%esp
    if (mm != NULL) {
c0109718:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010971c:	74 0e                	je     c010972c <unlock_mm+0x1a>
        unlock(&(mm->mm_lock));
c010971e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109721:	83 c0 1c             	add    $0x1c,%eax
c0109724:	89 04 24             	mov    %eax,(%esp)
c0109727:	e8 4c fe ff ff       	call   c0109578 <unlock>
    }
}
c010972c:	90                   	nop
c010972d:	c9                   	leave  
c010972e:	c3                   	ret    

c010972f <alloc_proc>:
void forkrets(struct trapframe *tf);
void switch_to(struct context *from, struct context *to);

// alloc_proc - alloc a proc_struct and init all fields of proc_struct
static struct proc_struct *
alloc_proc(void) {
c010972f:	f3 0f 1e fb          	endbr32 
c0109733:	55                   	push   %ebp
c0109734:	89 e5                	mov    %esp,%ebp
c0109736:	83 ec 28             	sub    $0x28,%esp
    struct proc_struct *proc = kmalloc(sizeof(struct proc_struct));
c0109739:	c7 04 24 7c 00 00 00 	movl   $0x7c,(%esp)
c0109740:	e8 c4 db ff ff       	call   c0107309 <kmalloc>
c0109745:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (proc != NULL) {
c0109748:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010974c:	0f 84 cd 00 00 00    	je     c010981f <alloc_proc+0xf0>
    //LAB4:EXERCISE1 YOUR CODE
   	proc->state=PROC_UNINIT;                      // Process state 
c0109752:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109755:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        proc->pid=-1;                                    // Process's ID
c010975b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010975e:	c7 40 04 ff ff ff ff 	movl   $0xffffffff,0x4(%eax)
        proc->runs=0;                                   // the running times of Proces
c0109765:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109768:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        proc->kstack=0;                           // Process kernel stack
c010976f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109772:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        proc->need_resched=0;                 // bool value: need to be rescheduled to release CPU?
c0109779:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010977c:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        proc->parent=NULL;                 // the parent process
c0109783:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109786:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
        proc->mm=NULL;                       // Process's memory management field
c010978d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109790:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
        memset(&(proc->context),0,sizeof(struct context));                     // Switch here to run process
c0109797:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010979a:	83 c0 1c             	add    $0x1c,%eax
c010979d:	c7 44 24 08 20 00 00 	movl   $0x20,0x8(%esp)
c01097a4:	00 
c01097a5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01097ac:	00 
c01097ad:	89 04 24             	mov    %eax,(%esp)
c01097b0:	e8 78 20 00 00       	call   c010b82d <memset>
        proc->tf=NULL;                       // Trap frame for current interrupt
c01097b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01097b8:	c7 40 3c 00 00 00 00 	movl   $0x0,0x3c(%eax)
        proc->cr3=boot_cr3;                              // CR3 register: the base addr of Page Directroy Table(PDT)
c01097bf:	8b 15 5c 40 1b c0    	mov    0xc01b405c,%edx
c01097c5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01097c8:	89 50 40             	mov    %edx,0x40(%eax)
        proc->flags=0;                             // Process flag
c01097cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01097ce:	c7 40 44 00 00 00 00 	movl   $0x0,0x44(%eax)
        memset(proc->name,0,PROC_NAME_LEN);               // Process name
c01097d5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01097d8:	83 c0 48             	add    $0x48,%eax
c01097db:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c01097e2:	00 
c01097e3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01097ea:	00 
c01097eb:	89 04 24             	mov    %eax,(%esp)
c01097ee:	e8 3a 20 00 00       	call   c010b82d <memset>
	proc->wait_state=0;
c01097f3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01097f6:	c7 40 6c 00 00 00 00 	movl   $0x0,0x6c(%eax)
	proc->cptr=proc->optr=proc->yptr=NULL;
c01097fd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109800:	c7 40 74 00 00 00 00 	movl   $0x0,0x74(%eax)
c0109807:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010980a:	8b 50 74             	mov    0x74(%eax),%edx
c010980d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109810:	89 50 78             	mov    %edx,0x78(%eax)
c0109813:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109816:	8b 50 78             	mov    0x78(%eax),%edx
c0109819:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010981c:	89 50 70             	mov    %edx,0x70(%eax)
    }
    return proc;
c010981f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0109822:	c9                   	leave  
c0109823:	c3                   	ret    

c0109824 <set_proc_name>:

// set_proc_name - set the name of proc
char *
set_proc_name(struct proc_struct *proc, const char *name) {
c0109824:	f3 0f 1e fb          	endbr32 
c0109828:	55                   	push   %ebp
c0109829:	89 e5                	mov    %esp,%ebp
c010982b:	83 ec 18             	sub    $0x18,%esp
    memset(proc->name, 0, sizeof(proc->name));
c010982e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109831:	83 c0 48             	add    $0x48,%eax
c0109834:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c010983b:	00 
c010983c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0109843:	00 
c0109844:	89 04 24             	mov    %eax,(%esp)
c0109847:	e8 e1 1f 00 00       	call   c010b82d <memset>
    return memcpy(proc->name, name, PROC_NAME_LEN);
c010984c:	8b 45 08             	mov    0x8(%ebp),%eax
c010984f:	8d 50 48             	lea    0x48(%eax),%edx
c0109852:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c0109859:	00 
c010985a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010985d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109861:	89 14 24             	mov    %edx,(%esp)
c0109864:	e8 ae 20 00 00       	call   c010b917 <memcpy>
}
c0109869:	c9                   	leave  
c010986a:	c3                   	ret    

c010986b <get_proc_name>:

// get_proc_name - get the name of proc
char *
get_proc_name(struct proc_struct *proc) {
c010986b:	f3 0f 1e fb          	endbr32 
c010986f:	55                   	push   %ebp
c0109870:	89 e5                	mov    %esp,%ebp
c0109872:	83 ec 18             	sub    $0x18,%esp
    static char name[PROC_NAME_LEN + 1];
    memset(name, 0, sizeof(name));
c0109875:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c010987c:	00 
c010987d:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0109884:	00 
c0109885:	c7 04 24 44 40 1b c0 	movl   $0xc01b4044,(%esp)
c010988c:	e8 9c 1f 00 00       	call   c010b82d <memset>
    return memcpy(name, proc->name, PROC_NAME_LEN);
c0109891:	8b 45 08             	mov    0x8(%ebp),%eax
c0109894:	83 c0 48             	add    $0x48,%eax
c0109897:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c010989e:	00 
c010989f:	89 44 24 04          	mov    %eax,0x4(%esp)
c01098a3:	c7 04 24 44 40 1b c0 	movl   $0xc01b4044,(%esp)
c01098aa:	e8 68 20 00 00       	call   c010b917 <memcpy>
}
c01098af:	c9                   	leave  
c01098b0:	c3                   	ret    

c01098b1 <set_links>:

// set_links - set the relation links of process
static void
set_links(struct proc_struct *proc) {
c01098b1:	f3 0f 1e fb          	endbr32 
c01098b5:	55                   	push   %ebp
c01098b6:	89 e5                	mov    %esp,%ebp
c01098b8:	83 ec 20             	sub    $0x20,%esp
    list_add(&proc_list, &(proc->list_link));
c01098bb:	8b 45 08             	mov    0x8(%ebp),%eax
c01098be:	83 c0 58             	add    $0x58,%eax
c01098c1:	c7 45 fc 50 41 1b c0 	movl   $0xc01b4150,-0x4(%ebp)
c01098c8:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01098cb:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01098ce:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01098d1:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01098d4:	89 45 f0             	mov    %eax,-0x10(%ebp)
    __list_add(elm, listelm, listelm->next);
c01098d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01098da:	8b 40 04             	mov    0x4(%eax),%eax
c01098dd:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01098e0:	89 55 ec             	mov    %edx,-0x14(%ebp)
c01098e3:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01098e6:	89 55 e8             	mov    %edx,-0x18(%ebp)
c01098e9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    prev->next = next->prev = elm;
c01098ec:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01098ef:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01098f2:	89 10                	mov    %edx,(%eax)
c01098f4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01098f7:	8b 10                	mov    (%eax),%edx
c01098f9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01098fc:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01098ff:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109902:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109905:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0109908:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010990b:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010990e:	89 10                	mov    %edx,(%eax)
}
c0109910:	90                   	nop
}
c0109911:	90                   	nop
}
c0109912:	90                   	nop
    proc->yptr = NULL;
c0109913:	8b 45 08             	mov    0x8(%ebp),%eax
c0109916:	c7 40 74 00 00 00 00 	movl   $0x0,0x74(%eax)
    if ((proc->optr = proc->parent->cptr) != NULL) {
c010991d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109920:	8b 40 14             	mov    0x14(%eax),%eax
c0109923:	8b 50 70             	mov    0x70(%eax),%edx
c0109926:	8b 45 08             	mov    0x8(%ebp),%eax
c0109929:	89 50 78             	mov    %edx,0x78(%eax)
c010992c:	8b 45 08             	mov    0x8(%ebp),%eax
c010992f:	8b 40 78             	mov    0x78(%eax),%eax
c0109932:	85 c0                	test   %eax,%eax
c0109934:	74 0c                	je     c0109942 <set_links+0x91>
        proc->optr->yptr = proc;
c0109936:	8b 45 08             	mov    0x8(%ebp),%eax
c0109939:	8b 40 78             	mov    0x78(%eax),%eax
c010993c:	8b 55 08             	mov    0x8(%ebp),%edx
c010993f:	89 50 74             	mov    %edx,0x74(%eax)
    }
    proc->parent->cptr = proc;
c0109942:	8b 45 08             	mov    0x8(%ebp),%eax
c0109945:	8b 40 14             	mov    0x14(%eax),%eax
c0109948:	8b 55 08             	mov    0x8(%ebp),%edx
c010994b:	89 50 70             	mov    %edx,0x70(%eax)
    nr_process ++;
c010994e:	a1 40 40 1b c0       	mov    0xc01b4040,%eax
c0109953:	40                   	inc    %eax
c0109954:	a3 40 40 1b c0       	mov    %eax,0xc01b4040
}
c0109959:	90                   	nop
c010995a:	c9                   	leave  
c010995b:	c3                   	ret    

c010995c <remove_links>:

// remove_links - clean the relation links of process
static void
remove_links(struct proc_struct *proc) {
c010995c:	f3 0f 1e fb          	endbr32 
c0109960:	55                   	push   %ebp
c0109961:	89 e5                	mov    %esp,%ebp
c0109963:	83 ec 10             	sub    $0x10,%esp
    list_del(&(proc->list_link));
c0109966:	8b 45 08             	mov    0x8(%ebp),%eax
c0109969:	83 c0 58             	add    $0x58,%eax
c010996c:	89 45 fc             	mov    %eax,-0x4(%ebp)
    __list_del(listelm->prev, listelm->next);
c010996f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109972:	8b 40 04             	mov    0x4(%eax),%eax
c0109975:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0109978:	8b 12                	mov    (%edx),%edx
c010997a:	89 55 f8             	mov    %edx,-0x8(%ebp)
c010997d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    prev->next = next;
c0109980:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109983:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109986:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0109989:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010998c:	8b 55 f8             	mov    -0x8(%ebp),%edx
c010998f:	89 10                	mov    %edx,(%eax)
}
c0109991:	90                   	nop
}
c0109992:	90                   	nop
    if (proc->optr != NULL) {
c0109993:	8b 45 08             	mov    0x8(%ebp),%eax
c0109996:	8b 40 78             	mov    0x78(%eax),%eax
c0109999:	85 c0                	test   %eax,%eax
c010999b:	74 0f                	je     c01099ac <remove_links+0x50>
        proc->optr->yptr = proc->yptr;
c010999d:	8b 45 08             	mov    0x8(%ebp),%eax
c01099a0:	8b 40 78             	mov    0x78(%eax),%eax
c01099a3:	8b 55 08             	mov    0x8(%ebp),%edx
c01099a6:	8b 52 74             	mov    0x74(%edx),%edx
c01099a9:	89 50 74             	mov    %edx,0x74(%eax)
    }
    if (proc->yptr != NULL) {
c01099ac:	8b 45 08             	mov    0x8(%ebp),%eax
c01099af:	8b 40 74             	mov    0x74(%eax),%eax
c01099b2:	85 c0                	test   %eax,%eax
c01099b4:	74 11                	je     c01099c7 <remove_links+0x6b>
        proc->yptr->optr = proc->optr;
c01099b6:	8b 45 08             	mov    0x8(%ebp),%eax
c01099b9:	8b 40 74             	mov    0x74(%eax),%eax
c01099bc:	8b 55 08             	mov    0x8(%ebp),%edx
c01099bf:	8b 52 78             	mov    0x78(%edx),%edx
c01099c2:	89 50 78             	mov    %edx,0x78(%eax)
c01099c5:	eb 0f                	jmp    c01099d6 <remove_links+0x7a>
    }
    else {
       proc->parent->cptr = proc->optr;
c01099c7:	8b 45 08             	mov    0x8(%ebp),%eax
c01099ca:	8b 40 14             	mov    0x14(%eax),%eax
c01099cd:	8b 55 08             	mov    0x8(%ebp),%edx
c01099d0:	8b 52 78             	mov    0x78(%edx),%edx
c01099d3:	89 50 70             	mov    %edx,0x70(%eax)
    }
    nr_process --;
c01099d6:	a1 40 40 1b c0       	mov    0xc01b4040,%eax
c01099db:	48                   	dec    %eax
c01099dc:	a3 40 40 1b c0       	mov    %eax,0xc01b4040
}
c01099e1:	90                   	nop
c01099e2:	c9                   	leave  
c01099e3:	c3                   	ret    

c01099e4 <get_pid>:

// get_pid - alloc a unique pid for process
static int
get_pid(void) {
c01099e4:	f3 0f 1e fb          	endbr32 
c01099e8:	55                   	push   %ebp
c01099e9:	89 e5                	mov    %esp,%ebp
c01099eb:	83 ec 10             	sub    $0x10,%esp
    static_assert(MAX_PID > MAX_PROCESS);
    struct proc_struct *proc;
    list_entry_t *list = &proc_list, *le;
c01099ee:	c7 45 f8 50 41 1b c0 	movl   $0xc01b4150,-0x8(%ebp)
    static int next_safe = MAX_PID, last_pid = MAX_PID;
    if (++ last_pid >= MAX_PID) {
c01099f5:	a1 6c ea 12 c0       	mov    0xc012ea6c,%eax
c01099fa:	40                   	inc    %eax
c01099fb:	a3 6c ea 12 c0       	mov    %eax,0xc012ea6c
c0109a00:	a1 6c ea 12 c0       	mov    0xc012ea6c,%eax
c0109a05:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0109a0a:	7e 0c                	jle    c0109a18 <get_pid+0x34>
        last_pid = 1;
c0109a0c:	c7 05 6c ea 12 c0 01 	movl   $0x1,0xc012ea6c
c0109a13:	00 00 00 
        goto inside;
c0109a16:	eb 14                	jmp    c0109a2c <get_pid+0x48>
    }
    if (last_pid >= next_safe) {
c0109a18:	8b 15 6c ea 12 c0    	mov    0xc012ea6c,%edx
c0109a1e:	a1 70 ea 12 c0       	mov    0xc012ea70,%eax
c0109a23:	39 c2                	cmp    %eax,%edx
c0109a25:	0f 8c ab 00 00 00    	jl     c0109ad6 <get_pid+0xf2>
    inside:
c0109a2b:	90                   	nop
        next_safe = MAX_PID;
c0109a2c:	c7 05 70 ea 12 c0 00 	movl   $0x2000,0xc012ea70
c0109a33:	20 00 00 
    repeat:
        le = list;
c0109a36:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109a39:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while ((le = list_next(le)) != list) {
c0109a3c:	eb 7d                	jmp    c0109abb <get_pid+0xd7>
            proc = le2proc(le, list_link);
c0109a3e:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109a41:	83 e8 58             	sub    $0x58,%eax
c0109a44:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (proc->pid == last_pid) {
c0109a47:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109a4a:	8b 50 04             	mov    0x4(%eax),%edx
c0109a4d:	a1 6c ea 12 c0       	mov    0xc012ea6c,%eax
c0109a52:	39 c2                	cmp    %eax,%edx
c0109a54:	75 3c                	jne    c0109a92 <get_pid+0xae>
                if (++ last_pid >= next_safe) {
c0109a56:	a1 6c ea 12 c0       	mov    0xc012ea6c,%eax
c0109a5b:	40                   	inc    %eax
c0109a5c:	a3 6c ea 12 c0       	mov    %eax,0xc012ea6c
c0109a61:	8b 15 6c ea 12 c0    	mov    0xc012ea6c,%edx
c0109a67:	a1 70 ea 12 c0       	mov    0xc012ea70,%eax
c0109a6c:	39 c2                	cmp    %eax,%edx
c0109a6e:	7c 4b                	jl     c0109abb <get_pid+0xd7>
                    if (last_pid >= MAX_PID) {
c0109a70:	a1 6c ea 12 c0       	mov    0xc012ea6c,%eax
c0109a75:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0109a7a:	7e 0a                	jle    c0109a86 <get_pid+0xa2>
                        last_pid = 1;
c0109a7c:	c7 05 6c ea 12 c0 01 	movl   $0x1,0xc012ea6c
c0109a83:	00 00 00 
                    }
                    next_safe = MAX_PID;
c0109a86:	c7 05 70 ea 12 c0 00 	movl   $0x2000,0xc012ea70
c0109a8d:	20 00 00 
                    goto repeat;
c0109a90:	eb a4                	jmp    c0109a36 <get_pid+0x52>
                }
            }
            else if (proc->pid > last_pid && next_safe > proc->pid) {
c0109a92:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109a95:	8b 50 04             	mov    0x4(%eax),%edx
c0109a98:	a1 6c ea 12 c0       	mov    0xc012ea6c,%eax
c0109a9d:	39 c2                	cmp    %eax,%edx
c0109a9f:	7e 1a                	jle    c0109abb <get_pid+0xd7>
c0109aa1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109aa4:	8b 50 04             	mov    0x4(%eax),%edx
c0109aa7:	a1 70 ea 12 c0       	mov    0xc012ea70,%eax
c0109aac:	39 c2                	cmp    %eax,%edx
c0109aae:	7d 0b                	jge    c0109abb <get_pid+0xd7>
                next_safe = proc->pid;
c0109ab0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109ab3:	8b 40 04             	mov    0x4(%eax),%eax
c0109ab6:	a3 70 ea 12 c0       	mov    %eax,0xc012ea70
c0109abb:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109abe:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return listelm->next;
c0109ac1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109ac4:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0109ac7:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0109aca:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109acd:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c0109ad0:	0f 85 68 ff ff ff    	jne    c0109a3e <get_pid+0x5a>
            }
        }
    }
    return last_pid;
c0109ad6:	a1 6c ea 12 c0       	mov    0xc012ea6c,%eax
}
c0109adb:	c9                   	leave  
c0109adc:	c3                   	ret    

c0109add <proc_run>:

// proc_run - make process "proc" running on cpu
// NOTE: before call switch_to, should load  base addr of "proc"'s new PDT
void
proc_run(struct proc_struct *proc) {
c0109add:	f3 0f 1e fb          	endbr32 
c0109ae1:	55                   	push   %ebp
c0109ae2:	89 e5                	mov    %esp,%ebp
c0109ae4:	83 ec 28             	sub    $0x28,%esp
    if (proc != current) {
c0109ae7:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0109aec:	39 45 08             	cmp    %eax,0x8(%ebp)
c0109aef:	74 64                	je     c0109b55 <proc_run+0x78>
        bool intr_flag;
        struct proc_struct *prev = current, *next = proc;
c0109af1:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0109af6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109af9:	8b 45 08             	mov    0x8(%ebp),%eax
c0109afc:	89 45 f0             	mov    %eax,-0x10(%ebp)
        local_intr_save(intr_flag);
c0109aff:	e8 f3 f9 ff ff       	call   c01094f7 <__intr_save>
c0109b04:	89 45 ec             	mov    %eax,-0x14(%ebp)
        {
            current = proc;
c0109b07:	8b 45 08             	mov    0x8(%ebp),%eax
c0109b0a:	a3 28 20 1b c0       	mov    %eax,0xc01b2028
            load_esp0(next->kstack + KSTACKSIZE);
c0109b0f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109b12:	8b 40 0c             	mov    0xc(%eax),%eax
c0109b15:	05 00 20 00 00       	add    $0x2000,%eax
c0109b1a:	89 04 24             	mov    %eax,(%esp)
c0109b1d:	e8 f7 9c ff ff       	call   c0103819 <load_esp0>
            lcr3(next->cr3);
c0109b22:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109b25:	8b 40 40             	mov    0x40(%eax),%eax
c0109b28:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c0109b2b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109b2e:	0f 22 d8             	mov    %eax,%cr3
}
c0109b31:	90                   	nop
            switch_to(&(prev->context), &(next->context));
c0109b32:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109b35:	8d 50 1c             	lea    0x1c(%eax),%edx
c0109b38:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109b3b:	83 c0 1c             	add    $0x1c,%eax
c0109b3e:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109b42:	89 04 24             	mov    %eax,(%esp)
c0109b45:	e8 2d f9 ff ff       	call   c0109477 <switch_to>
        }
        local_intr_restore(intr_flag);
c0109b4a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109b4d:	89 04 24             	mov    %eax,(%esp)
c0109b50:	e8 cc f9 ff ff       	call   c0109521 <__intr_restore>
    }
}
c0109b55:	90                   	nop
c0109b56:	c9                   	leave  
c0109b57:	c3                   	ret    

c0109b58 <forkret>:

// forkret -- the first kernel entry point of a new thread/process
// NOTE: the addr of forkret is setted in copy_thread function
//       after switch_to, the current proc will execute here.
static void
forkret(void) {
c0109b58:	f3 0f 1e fb          	endbr32 
c0109b5c:	55                   	push   %ebp
c0109b5d:	89 e5                	mov    %esp,%ebp
c0109b5f:	83 ec 18             	sub    $0x18,%esp
    forkrets(current->tf);
c0109b62:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0109b67:	8b 40 3c             	mov    0x3c(%eax),%eax
c0109b6a:	89 04 24             	mov    %eax,(%esp)
c0109b6d:	e8 ce 9a ff ff       	call   c0103640 <forkrets>
}
c0109b72:	90                   	nop
c0109b73:	c9                   	leave  
c0109b74:	c3                   	ret    

c0109b75 <hash_proc>:

// hash_proc - add proc into proc hash_list
static void
hash_proc(struct proc_struct *proc) {
c0109b75:	f3 0f 1e fb          	endbr32 
c0109b79:	55                   	push   %ebp
c0109b7a:	89 e5                	mov    %esp,%ebp
c0109b7c:	53                   	push   %ebx
c0109b7d:	83 ec 34             	sub    $0x34,%esp
    list_add(hash_list + pid_hashfn(proc->pid), &(proc->hash_link));
c0109b80:	8b 45 08             	mov    0x8(%ebp),%eax
c0109b83:	8d 58 60             	lea    0x60(%eax),%ebx
c0109b86:	8b 45 08             	mov    0x8(%ebp),%eax
c0109b89:	8b 40 04             	mov    0x4(%eax),%eax
c0109b8c:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0109b93:	00 
c0109b94:	89 04 24             	mov    %eax,(%esp)
c0109b97:	e8 b5 24 00 00       	call   c010c051 <hash32>
c0109b9c:	c1 e0 03             	shl    $0x3,%eax
c0109b9f:	05 40 20 1b c0       	add    $0xc01b2040,%eax
c0109ba4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109ba7:	89 5d f0             	mov    %ebx,-0x10(%ebp)
c0109baa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109bad:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109bb0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109bb3:	89 45 e8             	mov    %eax,-0x18(%ebp)
    __list_add(elm, listelm, listelm->next);
c0109bb6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109bb9:	8b 40 04             	mov    0x4(%eax),%eax
c0109bbc:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109bbf:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0109bc2:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109bc5:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0109bc8:	89 45 dc             	mov    %eax,-0x24(%ebp)
    prev->next = next->prev = elm;
c0109bcb:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109bce:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109bd1:	89 10                	mov    %edx,(%eax)
c0109bd3:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109bd6:	8b 10                	mov    (%eax),%edx
c0109bd8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109bdb:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0109bde:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109be1:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0109be4:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0109be7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109bea:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0109bed:	89 10                	mov    %edx,(%eax)
}
c0109bef:	90                   	nop
}
c0109bf0:	90                   	nop
}
c0109bf1:	90                   	nop
}
c0109bf2:	90                   	nop
c0109bf3:	83 c4 34             	add    $0x34,%esp
c0109bf6:	5b                   	pop    %ebx
c0109bf7:	5d                   	pop    %ebp
c0109bf8:	c3                   	ret    

c0109bf9 <unhash_proc>:

// unhash_proc - delete proc from proc hash_list
static void
unhash_proc(struct proc_struct *proc) {
c0109bf9:	f3 0f 1e fb          	endbr32 
c0109bfd:	55                   	push   %ebp
c0109bfe:	89 e5                	mov    %esp,%ebp
c0109c00:	83 ec 10             	sub    $0x10,%esp
    list_del(&(proc->hash_link));
c0109c03:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c06:	83 c0 60             	add    $0x60,%eax
c0109c09:	89 45 fc             	mov    %eax,-0x4(%ebp)
    __list_del(listelm->prev, listelm->next);
c0109c0c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109c0f:	8b 40 04             	mov    0x4(%eax),%eax
c0109c12:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0109c15:	8b 12                	mov    (%edx),%edx
c0109c17:	89 55 f8             	mov    %edx,-0x8(%ebp)
c0109c1a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    prev->next = next;
c0109c1d:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109c20:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109c23:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0109c26:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109c29:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0109c2c:	89 10                	mov    %edx,(%eax)
}
c0109c2e:	90                   	nop
}
c0109c2f:	90                   	nop
}
c0109c30:	90                   	nop
c0109c31:	c9                   	leave  
c0109c32:	c3                   	ret    

c0109c33 <find_proc>:

// find_proc - find proc frome proc hash_list according to pid
struct proc_struct *
find_proc(int pid) {
c0109c33:	f3 0f 1e fb          	endbr32 
c0109c37:	55                   	push   %ebp
c0109c38:	89 e5                	mov    %esp,%ebp
c0109c3a:	83 ec 28             	sub    $0x28,%esp
    if (0 < pid && pid < MAX_PID) {
c0109c3d:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0109c41:	7e 5f                	jle    c0109ca2 <find_proc+0x6f>
c0109c43:	81 7d 08 ff 1f 00 00 	cmpl   $0x1fff,0x8(%ebp)
c0109c4a:	7f 56                	jg     c0109ca2 <find_proc+0x6f>
        list_entry_t *list = hash_list + pid_hashfn(pid), *le = list;
c0109c4c:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c4f:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0109c56:	00 
c0109c57:	89 04 24             	mov    %eax,(%esp)
c0109c5a:	e8 f2 23 00 00       	call   c010c051 <hash32>
c0109c5f:	c1 e0 03             	shl    $0x3,%eax
c0109c62:	05 40 20 1b c0       	add    $0xc01b2040,%eax
c0109c67:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109c6a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109c6d:	89 45 f4             	mov    %eax,-0xc(%ebp)
        while ((le = list_next(le)) != list) {
c0109c70:	eb 19                	jmp    c0109c8b <find_proc+0x58>
            struct proc_struct *proc = le2proc(le, hash_link);
c0109c72:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109c75:	83 e8 60             	sub    $0x60,%eax
c0109c78:	89 45 ec             	mov    %eax,-0x14(%ebp)
            if (proc->pid == pid) {
c0109c7b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109c7e:	8b 40 04             	mov    0x4(%eax),%eax
c0109c81:	39 45 08             	cmp    %eax,0x8(%ebp)
c0109c84:	75 05                	jne    c0109c8b <find_proc+0x58>
                return proc;
c0109c86:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109c89:	eb 1c                	jmp    c0109ca7 <find_proc+0x74>
c0109c8b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109c8e:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return listelm->next;
c0109c91:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109c94:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0109c97:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109c9a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109c9d:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0109ca0:	75 d0                	jne    c0109c72 <find_proc+0x3f>
            }
        }
    }
    return NULL;
c0109ca2:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0109ca7:	c9                   	leave  
c0109ca8:	c3                   	ret    

c0109ca9 <kernel_thread>:

// kernel_thread - create a kernel thread using "fn" function
// NOTE: the contents of temp trapframe tf will be copied to 
//       proc->tf in do_fork-->copy_thread function
int
kernel_thread(int (*fn)(void *), void *arg, uint32_t clone_flags) {
c0109ca9:	f3 0f 1e fb          	endbr32 
c0109cad:	55                   	push   %ebp
c0109cae:	89 e5                	mov    %esp,%ebp
c0109cb0:	83 ec 68             	sub    $0x68,%esp
    struct trapframe tf;
    memset(&tf, 0, sizeof(struct trapframe));
c0109cb3:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
c0109cba:	00 
c0109cbb:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0109cc2:	00 
c0109cc3:	8d 45 ac             	lea    -0x54(%ebp),%eax
c0109cc6:	89 04 24             	mov    %eax,(%esp)
c0109cc9:	e8 5f 1b 00 00       	call   c010b82d <memset>
    tf.tf_cs = KERNEL_CS;
c0109cce:	66 c7 45 e8 08 00    	movw   $0x8,-0x18(%ebp)
    tf.tf_ds = tf.tf_es = tf.tf_ss = KERNEL_DS;
c0109cd4:	66 c7 45 f4 10 00    	movw   $0x10,-0xc(%ebp)
c0109cda:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c0109cde:	66 89 45 d4          	mov    %ax,-0x2c(%ebp)
c0109ce2:	0f b7 45 d4          	movzwl -0x2c(%ebp),%eax
c0109ce6:	66 89 45 d8          	mov    %ax,-0x28(%ebp)
    tf.tf_regs.reg_ebx = (uint32_t)fn;
c0109cea:	8b 45 08             	mov    0x8(%ebp),%eax
c0109ced:	89 45 bc             	mov    %eax,-0x44(%ebp)
    tf.tf_regs.reg_edx = (uint32_t)arg;
c0109cf0:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109cf3:	89 45 c0             	mov    %eax,-0x40(%ebp)
    tf.tf_eip = (uint32_t)kernel_thread_entry;
c0109cf6:	b8 ae 94 10 c0       	mov    $0xc01094ae,%eax
c0109cfb:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return do_fork(clone_flags | CLONE_VM, 0, &tf);
c0109cfe:	8b 45 10             	mov    0x10(%ebp),%eax
c0109d01:	0d 00 01 00 00       	or     $0x100,%eax
c0109d06:	89 c2                	mov    %eax,%edx
c0109d08:	8d 45 ac             	lea    -0x54(%ebp),%eax
c0109d0b:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109d0f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0109d16:	00 
c0109d17:	89 14 24             	mov    %edx,(%esp)
c0109d1a:	e8 54 03 00 00       	call   c010a073 <do_fork>
}
c0109d1f:	c9                   	leave  
c0109d20:	c3                   	ret    

c0109d21 <setup_kstack>:

// setup_kstack - alloc pages with size KSTACKPAGE as process kernel stack
static int
setup_kstack(struct proc_struct *proc) {
c0109d21:	f3 0f 1e fb          	endbr32 
c0109d25:	55                   	push   %ebp
c0109d26:	89 e5                	mov    %esp,%ebp
c0109d28:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_pages(KSTACKPAGE);
c0109d2b:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c0109d32:	e8 3e 9c ff ff       	call   c0103975 <alloc_pages>
c0109d37:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c0109d3a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0109d3e:	74 1a                	je     c0109d5a <setup_kstack+0x39>
        proc->kstack = (uintptr_t)page2kva(page);
c0109d40:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109d43:	89 04 24             	mov    %eax,(%esp)
c0109d46:	e8 d8 f8 ff ff       	call   c0109623 <page2kva>
c0109d4b:	89 c2                	mov    %eax,%edx
c0109d4d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109d50:	89 50 0c             	mov    %edx,0xc(%eax)
        return 0;
c0109d53:	b8 00 00 00 00       	mov    $0x0,%eax
c0109d58:	eb 05                	jmp    c0109d5f <setup_kstack+0x3e>
    }
    return -E_NO_MEM;
c0109d5a:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
}
c0109d5f:	c9                   	leave  
c0109d60:	c3                   	ret    

c0109d61 <put_kstack>:

// put_kstack - free the memory space of process kernel stack
static void
put_kstack(struct proc_struct *proc) {
c0109d61:	f3 0f 1e fb          	endbr32 
c0109d65:	55                   	push   %ebp
c0109d66:	89 e5                	mov    %esp,%ebp
c0109d68:	83 ec 18             	sub    $0x18,%esp
    free_pages(kva2page((void *)(proc->kstack)), KSTACKPAGE);
c0109d6b:	8b 45 08             	mov    0x8(%ebp),%eax
c0109d6e:	8b 40 0c             	mov    0xc(%eax),%eax
c0109d71:	89 04 24             	mov    %eax,(%esp)
c0109d74:	e8 fe f8 ff ff       	call   c0109677 <kva2page>
c0109d79:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c0109d80:	00 
c0109d81:	89 04 24             	mov    %eax,(%esp)
c0109d84:	e8 5b 9c ff ff       	call   c01039e4 <free_pages>
}
c0109d89:	90                   	nop
c0109d8a:	c9                   	leave  
c0109d8b:	c3                   	ret    

c0109d8c <setup_pgdir>:

// setup_pgdir - alloc one page as PDT
static int
setup_pgdir(struct mm_struct *mm) {
c0109d8c:	f3 0f 1e fb          	endbr32 
c0109d90:	55                   	push   %ebp
c0109d91:	89 e5                	mov    %esp,%ebp
c0109d93:	83 ec 28             	sub    $0x28,%esp
    struct Page *page;
    if ((page = alloc_page()) == NULL) {
c0109d96:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0109d9d:	e8 d3 9b ff ff       	call   c0103975 <alloc_pages>
c0109da2:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109da5:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0109da9:	75 0a                	jne    c0109db5 <setup_pgdir+0x29>
        return -E_NO_MEM;
c0109dab:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c0109db0:	e9 80 00 00 00       	jmp    c0109e35 <setup_pgdir+0xa9>
    }
    pde_t *pgdir = page2kva(page);
c0109db5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109db8:	89 04 24             	mov    %eax,(%esp)
c0109dbb:	e8 63 f8 ff ff       	call   c0109623 <page2kva>
c0109dc0:	89 45 f0             	mov    %eax,-0x10(%ebp)
    memcpy(pgdir, boot_pgdir, PGSIZE);
c0109dc3:	a1 e0 e9 12 c0       	mov    0xc012e9e0,%eax
c0109dc8:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0109dcf:	00 
c0109dd0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109dd4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109dd7:	89 04 24             	mov    %eax,(%esp)
c0109dda:	e8 38 1b 00 00       	call   c010b917 <memcpy>
    pgdir[PDX(VPT)] = PADDR(pgdir) | PTE_P | PTE_W;
c0109ddf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109de2:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109de5:	81 7d ec ff ff ff bf 	cmpl   $0xbfffffff,-0x14(%ebp)
c0109dec:	77 23                	ja     c0109e11 <setup_pgdir+0x85>
c0109dee:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109df1:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109df5:	c7 44 24 08 18 e2 10 	movl   $0xc010e218,0x8(%esp)
c0109dfc:	c0 
c0109dfd:	c7 44 24 04 19 01 00 	movl   $0x119,0x4(%esp)
c0109e04:	00 
c0109e05:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c0109e0c:	e8 2c 66 ff ff       	call   c010043d <__panic>
c0109e11:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109e14:	8d 90 00 00 00 40    	lea    0x40000000(%eax),%edx
c0109e1a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109e1d:	05 ac 0f 00 00       	add    $0xfac,%eax
c0109e22:	83 ca 03             	or     $0x3,%edx
c0109e25:	89 10                	mov    %edx,(%eax)
    mm->pgdir = pgdir;
c0109e27:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e2a:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109e2d:	89 50 0c             	mov    %edx,0xc(%eax)
    return 0;
c0109e30:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0109e35:	c9                   	leave  
c0109e36:	c3                   	ret    

c0109e37 <put_pgdir>:

// put_pgdir - free the memory space of PDT
static void
put_pgdir(struct mm_struct *mm) {
c0109e37:	f3 0f 1e fb          	endbr32 
c0109e3b:	55                   	push   %ebp
c0109e3c:	89 e5                	mov    %esp,%ebp
c0109e3e:	83 ec 18             	sub    $0x18,%esp
    free_page(kva2page(mm->pgdir));
c0109e41:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e44:	8b 40 0c             	mov    0xc(%eax),%eax
c0109e47:	89 04 24             	mov    %eax,(%esp)
c0109e4a:	e8 28 f8 ff ff       	call   c0109677 <kva2page>
c0109e4f:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0109e56:	00 
c0109e57:	89 04 24             	mov    %eax,(%esp)
c0109e5a:	e8 85 9b ff ff       	call   c01039e4 <free_pages>
}
c0109e5f:	90                   	nop
c0109e60:	c9                   	leave  
c0109e61:	c3                   	ret    

c0109e62 <copy_mm>:

// copy_mm - process "proc" duplicate OR share process "current"'s mm according clone_flags
//         - if clone_flags & CLONE_VM, then "share" ; else "duplicate"
static int
copy_mm(uint32_t clone_flags, struct proc_struct *proc) {
c0109e62:	f3 0f 1e fb          	endbr32 
c0109e66:	55                   	push   %ebp
c0109e67:	89 e5                	mov    %esp,%ebp
c0109e69:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm, *oldmm = current->mm;
c0109e6c:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c0109e71:	8b 40 18             	mov    0x18(%eax),%eax
c0109e74:	89 45 ec             	mov    %eax,-0x14(%ebp)

    /* current is a kernel thread */
    if (oldmm == NULL) {
c0109e77:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0109e7b:	75 0a                	jne    c0109e87 <copy_mm+0x25>
        return 0;
c0109e7d:	b8 00 00 00 00       	mov    $0x0,%eax
c0109e82:	e9 00 01 00 00       	jmp    c0109f87 <copy_mm+0x125>
    }
    if (clone_flags & CLONE_VM) {
c0109e87:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e8a:	25 00 01 00 00       	and    $0x100,%eax
c0109e8f:	85 c0                	test   %eax,%eax
c0109e91:	74 08                	je     c0109e9b <copy_mm+0x39>
        mm = oldmm;
c0109e93:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109e96:	89 45 f4             	mov    %eax,-0xc(%ebp)
        goto good_mm;
c0109e99:	eb 5e                	jmp    c0109ef9 <copy_mm+0x97>
    }

    int ret = -E_NO_MEM;
c0109e9b:	c7 45 f0 fc ff ff ff 	movl   $0xfffffffc,-0x10(%ebp)
    if ((mm = mm_create()) == NULL) {
c0109ea2:	e8 4a bc ff ff       	call   c0105af1 <mm_create>
c0109ea7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109eaa:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0109eae:	0f 84 cf 00 00 00    	je     c0109f83 <copy_mm+0x121>
        goto bad_mm;
    }
    if (setup_pgdir(mm) != 0) {
c0109eb4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109eb7:	89 04 24             	mov    %eax,(%esp)
c0109eba:	e8 cd fe ff ff       	call   c0109d8c <setup_pgdir>
c0109ebf:	85 c0                	test   %eax,%eax
c0109ec1:	0f 85 ae 00 00 00    	jne    c0109f75 <copy_mm+0x113>
        goto bad_pgdir_cleanup_mm;
    }

    lock_mm(oldmm);
c0109ec7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109eca:	89 04 24             	mov    %eax,(%esp)
c0109ecd:	e8 23 f8 ff ff       	call   c01096f5 <lock_mm>
    {
        ret = dup_mmap(mm, oldmm);
c0109ed2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109ed5:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ed9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109edc:	89 04 24             	mov    %eax,(%esp)
c0109edf:	e8 41 c1 ff ff       	call   c0106025 <dup_mmap>
c0109ee4:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    unlock_mm(oldmm);
c0109ee7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109eea:	89 04 24             	mov    %eax,(%esp)
c0109eed:	e8 20 f8 ff ff       	call   c0109712 <unlock_mm>

    if (ret != 0) {
c0109ef2:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0109ef6:	75 60                	jne    c0109f58 <copy_mm+0xf6>
        goto bad_dup_cleanup_mmap;
    }

good_mm:
c0109ef8:	90                   	nop
    mm_count_inc(mm);
c0109ef9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109efc:	89 04 24             	mov    %eax,(%esp)
c0109eff:	e8 bd f7 ff ff       	call   c01096c1 <mm_count_inc>
    proc->mm = mm;
c0109f04:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109f07:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109f0a:	89 50 18             	mov    %edx,0x18(%eax)
    proc->cr3 = PADDR(mm->pgdir);
c0109f0d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109f10:	8b 40 0c             	mov    0xc(%eax),%eax
c0109f13:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109f16:	81 7d e8 ff ff ff bf 	cmpl   $0xbfffffff,-0x18(%ebp)
c0109f1d:	77 23                	ja     c0109f42 <copy_mm+0xe0>
c0109f1f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109f22:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109f26:	c7 44 24 08 18 e2 10 	movl   $0xc010e218,0x8(%esp)
c0109f2d:	c0 
c0109f2e:	c7 44 24 04 48 01 00 	movl   $0x148,0x4(%esp)
c0109f35:	00 
c0109f36:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c0109f3d:	e8 fb 64 ff ff       	call   c010043d <__panic>
c0109f42:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109f45:	8d 90 00 00 00 40    	lea    0x40000000(%eax),%edx
c0109f4b:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109f4e:	89 50 40             	mov    %edx,0x40(%eax)
    return 0;
c0109f51:	b8 00 00 00 00       	mov    $0x0,%eax
c0109f56:	eb 2f                	jmp    c0109f87 <copy_mm+0x125>
        goto bad_dup_cleanup_mmap;
c0109f58:	90                   	nop
c0109f59:	f3 0f 1e fb          	endbr32 
bad_dup_cleanup_mmap:
    exit_mmap(mm);
c0109f5d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109f60:	89 04 24             	mov    %eax,(%esp)
c0109f63:	e8 c2 c1 ff ff       	call   c010612a <exit_mmap>
    put_pgdir(mm);
c0109f68:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109f6b:	89 04 24             	mov    %eax,(%esp)
c0109f6e:	e8 c4 fe ff ff       	call   c0109e37 <put_pgdir>
c0109f73:	eb 01                	jmp    c0109f76 <copy_mm+0x114>
        goto bad_pgdir_cleanup_mm;
c0109f75:	90                   	nop
bad_pgdir_cleanup_mm:
    mm_destroy(mm);
c0109f76:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109f79:	89 04 24             	mov    %eax,(%esp)
c0109f7c:	e8 df be ff ff       	call   c0105e60 <mm_destroy>
c0109f81:	eb 01                	jmp    c0109f84 <copy_mm+0x122>
        goto bad_mm;
c0109f83:	90                   	nop
bad_mm:
    return ret;
c0109f84:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0109f87:	c9                   	leave  
c0109f88:	c3                   	ret    

c0109f89 <copy_thread>:

// copy_thread - setup the trapframe on the  process's kernel stack top and
//             - setup the kernel entry point and stack of process
static void
copy_thread(struct proc_struct *proc, uintptr_t esp, struct trapframe *tf) {
c0109f89:	f3 0f 1e fb          	endbr32 
c0109f8d:	55                   	push   %ebp
c0109f8e:	89 e5                	mov    %esp,%ebp
c0109f90:	57                   	push   %edi
c0109f91:	56                   	push   %esi
c0109f92:	53                   	push   %ebx
    proc->tf = (struct trapframe *)(proc->kstack + KSTACKSIZE) - 1;
c0109f93:	8b 45 08             	mov    0x8(%ebp),%eax
c0109f96:	8b 40 0c             	mov    0xc(%eax),%eax
c0109f99:	05 b4 1f 00 00       	add    $0x1fb4,%eax
c0109f9e:	89 c2                	mov    %eax,%edx
c0109fa0:	8b 45 08             	mov    0x8(%ebp),%eax
c0109fa3:	89 50 3c             	mov    %edx,0x3c(%eax)
    *(proc->tf) = *tf;
c0109fa6:	8b 45 08             	mov    0x8(%ebp),%eax
c0109fa9:	8b 40 3c             	mov    0x3c(%eax),%eax
c0109fac:	8b 55 10             	mov    0x10(%ebp),%edx
c0109faf:	bb 4c 00 00 00       	mov    $0x4c,%ebx
c0109fb4:	89 c1                	mov    %eax,%ecx
c0109fb6:	83 e1 01             	and    $0x1,%ecx
c0109fb9:	85 c9                	test   %ecx,%ecx
c0109fbb:	74 0c                	je     c0109fc9 <copy_thread+0x40>
c0109fbd:	0f b6 0a             	movzbl (%edx),%ecx
c0109fc0:	88 08                	mov    %cl,(%eax)
c0109fc2:	8d 40 01             	lea    0x1(%eax),%eax
c0109fc5:	8d 52 01             	lea    0x1(%edx),%edx
c0109fc8:	4b                   	dec    %ebx
c0109fc9:	89 c1                	mov    %eax,%ecx
c0109fcb:	83 e1 02             	and    $0x2,%ecx
c0109fce:	85 c9                	test   %ecx,%ecx
c0109fd0:	74 0f                	je     c0109fe1 <copy_thread+0x58>
c0109fd2:	0f b7 0a             	movzwl (%edx),%ecx
c0109fd5:	66 89 08             	mov    %cx,(%eax)
c0109fd8:	8d 40 02             	lea    0x2(%eax),%eax
c0109fdb:	8d 52 02             	lea    0x2(%edx),%edx
c0109fde:	83 eb 02             	sub    $0x2,%ebx
c0109fe1:	89 df                	mov    %ebx,%edi
c0109fe3:	83 e7 fc             	and    $0xfffffffc,%edi
c0109fe6:	b9 00 00 00 00       	mov    $0x0,%ecx
c0109feb:	8b 34 0a             	mov    (%edx,%ecx,1),%esi
c0109fee:	89 34 08             	mov    %esi,(%eax,%ecx,1)
c0109ff1:	83 c1 04             	add    $0x4,%ecx
c0109ff4:	39 f9                	cmp    %edi,%ecx
c0109ff6:	72 f3                	jb     c0109feb <copy_thread+0x62>
c0109ff8:	01 c8                	add    %ecx,%eax
c0109ffa:	01 ca                	add    %ecx,%edx
c0109ffc:	b9 00 00 00 00       	mov    $0x0,%ecx
c010a001:	89 de                	mov    %ebx,%esi
c010a003:	83 e6 02             	and    $0x2,%esi
c010a006:	85 f6                	test   %esi,%esi
c010a008:	74 0b                	je     c010a015 <copy_thread+0x8c>
c010a00a:	0f b7 34 0a          	movzwl (%edx,%ecx,1),%esi
c010a00e:	66 89 34 08          	mov    %si,(%eax,%ecx,1)
c010a012:	83 c1 02             	add    $0x2,%ecx
c010a015:	83 e3 01             	and    $0x1,%ebx
c010a018:	85 db                	test   %ebx,%ebx
c010a01a:	74 07                	je     c010a023 <copy_thread+0x9a>
c010a01c:	0f b6 14 0a          	movzbl (%edx,%ecx,1),%edx
c010a020:	88 14 08             	mov    %dl,(%eax,%ecx,1)
    proc->tf->tf_regs.reg_eax = 0;
c010a023:	8b 45 08             	mov    0x8(%ebp),%eax
c010a026:	8b 40 3c             	mov    0x3c(%eax),%eax
c010a029:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
    proc->tf->tf_esp = esp;
c010a030:	8b 45 08             	mov    0x8(%ebp),%eax
c010a033:	8b 40 3c             	mov    0x3c(%eax),%eax
c010a036:	8b 55 0c             	mov    0xc(%ebp),%edx
c010a039:	89 50 44             	mov    %edx,0x44(%eax)
    proc->tf->tf_eflags |= FL_IF;
c010a03c:	8b 45 08             	mov    0x8(%ebp),%eax
c010a03f:	8b 40 3c             	mov    0x3c(%eax),%eax
c010a042:	8b 50 40             	mov    0x40(%eax),%edx
c010a045:	8b 45 08             	mov    0x8(%ebp),%eax
c010a048:	8b 40 3c             	mov    0x3c(%eax),%eax
c010a04b:	81 ca 00 02 00 00    	or     $0x200,%edx
c010a051:	89 50 40             	mov    %edx,0x40(%eax)

    proc->context.eip = (uintptr_t)forkret;
c010a054:	ba 58 9b 10 c0       	mov    $0xc0109b58,%edx
c010a059:	8b 45 08             	mov    0x8(%ebp),%eax
c010a05c:	89 50 1c             	mov    %edx,0x1c(%eax)
    proc->context.esp = (uintptr_t)(proc->tf);
c010a05f:	8b 45 08             	mov    0x8(%ebp),%eax
c010a062:	8b 40 3c             	mov    0x3c(%eax),%eax
c010a065:	89 c2                	mov    %eax,%edx
c010a067:	8b 45 08             	mov    0x8(%ebp),%eax
c010a06a:	89 50 20             	mov    %edx,0x20(%eax)
}
c010a06d:	90                   	nop
c010a06e:	5b                   	pop    %ebx
c010a06f:	5e                   	pop    %esi
c010a070:	5f                   	pop    %edi
c010a071:	5d                   	pop    %ebp
c010a072:	c3                   	ret    

c010a073 <do_fork>:
 * @clone_flags: used to guide how to clone the child process
 * @stack:       the parent's user stack pointer. if stack==0, It means to fork a kernel thread.
 * @tf:          the trapframe info, which will be copied to child process's proc->tf
 */
int
do_fork(uint32_t clone_flags, uintptr_t stack, struct trapframe *tf) {
c010a073:	f3 0f 1e fb          	endbr32 
c010a077:	55                   	push   %ebp
c010a078:	89 e5                	mov    %esp,%ebp
c010a07a:	83 ec 28             	sub    $0x28,%esp
    int ret = -E_NO_FREE_PROC;
c010a07d:	c7 45 f4 fb ff ff ff 	movl   $0xfffffffb,-0xc(%ebp)
    struct proc_struct *proc;
    if (nr_process >= MAX_PROCESS) {
c010a084:	a1 40 40 1b c0       	mov    0xc01b4040,%eax
c010a089:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c010a08e:	0f 8f e1 00 00 00    	jg     c010a175 <do_fork+0x102>
        goto fork_out;
    }
    ret = -E_NO_MEM;
c010a094:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)
     * VARIABLES:
     *   proc_list:    the process set's list
     *   nr_process:   the number of process set
     */
    
    if(!(proc=alloc_proc())) goto fork_out;//    1. call alloc_proc to allocate a proc_struct
c010a09b:	e8 8f f6 ff ff       	call   c010972f <alloc_proc>
c010a0a0:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010a0a3:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010a0a7:	0f 84 cb 00 00 00    	je     c010a178 <do_fork+0x105>
    proc->parent=current;//   copy_thread:  setup the trapframe on the  process's kernel stack top and
c010a0ad:	8b 15 28 20 1b c0    	mov    0xc01b2028,%edx
c010a0b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a0b6:	89 50 14             	mov    %edx,0x14(%eax)
    assert(current->wait_state==0);
c010a0b9:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a0be:	8b 40 6c             	mov    0x6c(%eax),%eax
c010a0c1:	85 c0                	test   %eax,%eax
c010a0c3:	74 24                	je     c010a0e9 <do_fork+0x76>
c010a0c5:	c7 44 24 0c 50 e2 10 	movl   $0xc010e250,0xc(%esp)
c010a0cc:	c0 
c010a0cd:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010a0d4:	c0 
c010a0d5:	c7 44 24 04 82 01 00 	movl   $0x182,0x4(%esp)
c010a0dc:	00 
c010a0dd:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a0e4:	e8 54 63 ff ff       	call   c010043d <__panic>
    if(setup_kstack(proc)) goto bad_fork_cleanup_proc;//    2. call setup_kstack to allocate a kernel stack for child process
c010a0e9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a0ec:	89 04 24             	mov    %eax,(%esp)
c010a0ef:	e8 2d fc ff ff       	call   c0109d21 <setup_kstack>
c010a0f4:	85 c0                	test   %eax,%eax
c010a0f6:	0f 85 94 00 00 00    	jne    c010a190 <do_fork+0x11d>
    if(copy_mm(clone_flags,proc)) goto bad_fork_cleanup_kstack;//    3. call copy_mm to dup OR share mm according clone_flag
c010a0fc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a0ff:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a103:	8b 45 08             	mov    0x8(%ebp),%eax
c010a106:	89 04 24             	mov    %eax,(%esp)
c010a109:	e8 54 fd ff ff       	call   c0109e62 <copy_mm>
c010a10e:	85 c0                	test   %eax,%eax
c010a110:	75 6c                	jne    c010a17e <do_fork+0x10b>
    copy_thread(proc,stack,tf);//    4. call copy_thread to setup tf & context in proc_struct
c010a112:	8b 45 10             	mov    0x10(%ebp),%eax
c010a115:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a119:	8b 45 0c             	mov    0xc(%ebp),%eax
c010a11c:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a120:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a123:	89 04 24             	mov    %eax,(%esp)
c010a126:	e8 5e fe ff ff       	call   c0109f89 <copy_thread>
    bool intr;
    local_intr_save(intr);
c010a12b:	e8 c7 f3 ff ff       	call   c01094f7 <__intr_save>
c010a130:	89 45 ec             	mov    %eax,-0x14(%ebp)
    {         
	    proc->pid=get_pid();
c010a133:	e8 ac f8 ff ff       	call   c01099e4 <get_pid>
c010a138:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010a13b:	89 42 04             	mov    %eax,0x4(%edx)
	    set_links(proc);
c010a13e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a141:	89 04 24             	mov    %eax,(%esp)
c010a144:	e8 68 f7 ff ff       	call   c01098b1 <set_links>
	    hash_proc(proc);
c010a149:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a14c:	89 04 24             	mov    %eax,(%esp)
c010a14f:	e8 21 fa ff ff       	call   c0109b75 <hash_proc>
    }
    local_intr_restore(intr);
c010a154:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a157:	89 04 24             	mov    %eax,(%esp)
c010a15a:	e8 c2 f3 ff ff       	call   c0109521 <__intr_restore>
    wakeup_proc(proc);//    6. call wakeup_proc to make the new child process RUNNABLE
c010a15f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a162:	89 04 24             	mov    %eax,(%esp)
c010a165:	e8 08 10 00 00       	call   c010b172 <wakeup_proc>
    ret=proc->pid;//    7. set ret vaule using child proc's pid
c010a16a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a16d:	8b 40 04             	mov    0x4(%eax),%eax
c010a170:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010a173:	eb 04                	jmp    c010a179 <do_fork+0x106>
        goto fork_out;
c010a175:	90                   	nop
c010a176:	eb 01                	jmp    c010a179 <do_fork+0x106>
    if(!(proc=alloc_proc())) goto fork_out;//    1. call alloc_proc to allocate a proc_struct
c010a178:	90                   	nop
	*    update step 1: set child proc's parent to current process, make sure current process's wait_state is 0
	*    update step 5: insert proc_struct into hash_list && proc_list, set the relation links of process
    */
	
fork_out:
    return ret;
c010a179:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a17c:	eb 20                	jmp    c010a19e <do_fork+0x12b>
    if(copy_mm(clone_flags,proc)) goto bad_fork_cleanup_kstack;//    3. call copy_mm to dup OR share mm according clone_flag
c010a17e:	90                   	nop
c010a17f:	f3 0f 1e fb          	endbr32 

bad_fork_cleanup_kstack:
    put_kstack(proc);
c010a183:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a186:	89 04 24             	mov    %eax,(%esp)
c010a189:	e8 d3 fb ff ff       	call   c0109d61 <put_kstack>
c010a18e:	eb 01                	jmp    c010a191 <do_fork+0x11e>
    if(setup_kstack(proc)) goto bad_fork_cleanup_proc;//    2. call setup_kstack to allocate a kernel stack for child process
c010a190:	90                   	nop
bad_fork_cleanup_proc:
    kfree(proc);
c010a191:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a194:	89 04 24             	mov    %eax,(%esp)
c010a197:	e8 8c d1 ff ff       	call   c0107328 <kfree>
    goto fork_out;
c010a19c:	eb db                	jmp    c010a179 <do_fork+0x106>
}
c010a19e:	c9                   	leave  
c010a19f:	c3                   	ret    

c010a1a0 <do_exit>:
// do_exit - called by sys_exit
//   1. call exit_mmap & put_pgdir & mm_destroy to free the almost all memory space of process
//   2. set process' state as PROC_ZOMBIE, then call wakeup_proc(parent) to ask parent reclaim itself.
//   3. call scheduler to switch to other process
int
do_exit(int error_code) {
c010a1a0:	f3 0f 1e fb          	endbr32 
c010a1a4:	55                   	push   %ebp
c010a1a5:	89 e5                	mov    %esp,%ebp
c010a1a7:	83 ec 28             	sub    $0x28,%esp
    if (current == idleproc) {
c010a1aa:	8b 15 28 20 1b c0    	mov    0xc01b2028,%edx
c010a1b0:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010a1b5:	39 c2                	cmp    %eax,%edx
c010a1b7:	75 1c                	jne    c010a1d5 <do_exit+0x35>
        panic("idleproc exit.\n");
c010a1b9:	c7 44 24 08 7c e2 10 	movl   $0xc010e27c,0x8(%esp)
c010a1c0:	c0 
c010a1c1:	c7 44 24 04 aa 01 00 	movl   $0x1aa,0x4(%esp)
c010a1c8:	00 
c010a1c9:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a1d0:	e8 68 62 ff ff       	call   c010043d <__panic>
    }
    if (current == initproc) {
c010a1d5:	8b 15 28 20 1b c0    	mov    0xc01b2028,%edx
c010a1db:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010a1e0:	39 c2                	cmp    %eax,%edx
c010a1e2:	75 1c                	jne    c010a200 <do_exit+0x60>
        panic("initproc exit.\n");
c010a1e4:	c7 44 24 08 8c e2 10 	movl   $0xc010e28c,0x8(%esp)
c010a1eb:	c0 
c010a1ec:	c7 44 24 04 ad 01 00 	movl   $0x1ad,0x4(%esp)
c010a1f3:	00 
c010a1f4:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a1fb:	e8 3d 62 ff ff       	call   c010043d <__panic>
    }
    
    struct mm_struct *mm = current->mm;
c010a200:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a205:	8b 40 18             	mov    0x18(%eax),%eax
c010a208:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (mm != NULL) {
c010a20b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010a20f:	74 4b                	je     c010a25c <do_exit+0xbc>
        lcr3(boot_cr3);
c010a211:	a1 5c 40 1b c0       	mov    0xc01b405c,%eax
c010a216:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c010a219:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a21c:	0f 22 d8             	mov    %eax,%cr3
}
c010a21f:	90                   	nop
        if (mm_count_dec(mm) == 0) {
c010a220:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a223:	89 04 24             	mov    %eax,(%esp)
c010a226:	e8 b0 f4 ff ff       	call   c01096db <mm_count_dec>
c010a22b:	85 c0                	test   %eax,%eax
c010a22d:	75 21                	jne    c010a250 <do_exit+0xb0>
            exit_mmap(mm);
c010a22f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a232:	89 04 24             	mov    %eax,(%esp)
c010a235:	e8 f0 be ff ff       	call   c010612a <exit_mmap>
            put_pgdir(mm);
c010a23a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a23d:	89 04 24             	mov    %eax,(%esp)
c010a240:	e8 f2 fb ff ff       	call   c0109e37 <put_pgdir>
            mm_destroy(mm);
c010a245:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a248:	89 04 24             	mov    %eax,(%esp)
c010a24b:	e8 10 bc ff ff       	call   c0105e60 <mm_destroy>
        }
        current->mm = NULL;
c010a250:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a255:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
    }
    current->state = PROC_ZOMBIE;
c010a25c:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a261:	c7 00 03 00 00 00    	movl   $0x3,(%eax)
    current->exit_code = error_code;
c010a267:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a26c:	8b 55 08             	mov    0x8(%ebp),%edx
c010a26f:	89 50 68             	mov    %edx,0x68(%eax)
    
    bool intr_flag;
    struct proc_struct *proc;
    local_intr_save(intr_flag);
c010a272:	e8 80 f2 ff ff       	call   c01094f7 <__intr_save>
c010a277:	89 45 f0             	mov    %eax,-0x10(%ebp)
    {
        proc = current->parent;
c010a27a:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a27f:	8b 40 14             	mov    0x14(%eax),%eax
c010a282:	89 45 ec             	mov    %eax,-0x14(%ebp)
        if (proc->wait_state == WT_CHILD) {
c010a285:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a288:	8b 40 6c             	mov    0x6c(%eax),%eax
c010a28b:	3d 01 00 00 80       	cmp    $0x80000001,%eax
c010a290:	0f 85 96 00 00 00    	jne    c010a32c <do_exit+0x18c>
            wakeup_proc(proc);
c010a296:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a299:	89 04 24             	mov    %eax,(%esp)
c010a29c:	e8 d1 0e 00 00       	call   c010b172 <wakeup_proc>
        }
        while (current->cptr != NULL) {
c010a2a1:	e9 86 00 00 00       	jmp    c010a32c <do_exit+0x18c>
            proc = current->cptr;
c010a2a6:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a2ab:	8b 40 70             	mov    0x70(%eax),%eax
c010a2ae:	89 45 ec             	mov    %eax,-0x14(%ebp)
            current->cptr = proc->optr;
c010a2b1:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a2b6:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010a2b9:	8b 52 78             	mov    0x78(%edx),%edx
c010a2bc:	89 50 70             	mov    %edx,0x70(%eax)
    
            proc->yptr = NULL;
c010a2bf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a2c2:	c7 40 74 00 00 00 00 	movl   $0x0,0x74(%eax)
            if ((proc->optr = initproc->cptr) != NULL) {
c010a2c9:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010a2ce:	8b 50 70             	mov    0x70(%eax),%edx
c010a2d1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a2d4:	89 50 78             	mov    %edx,0x78(%eax)
c010a2d7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a2da:	8b 40 78             	mov    0x78(%eax),%eax
c010a2dd:	85 c0                	test   %eax,%eax
c010a2df:	74 0e                	je     c010a2ef <do_exit+0x14f>
                initproc->cptr->yptr = proc;
c010a2e1:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010a2e6:	8b 40 70             	mov    0x70(%eax),%eax
c010a2e9:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010a2ec:	89 50 74             	mov    %edx,0x74(%eax)
            }
            proc->parent = initproc;
c010a2ef:	8b 15 24 20 1b c0    	mov    0xc01b2024,%edx
c010a2f5:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a2f8:	89 50 14             	mov    %edx,0x14(%eax)
            initproc->cptr = proc;
c010a2fb:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010a300:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010a303:	89 50 70             	mov    %edx,0x70(%eax)
            if (proc->state == PROC_ZOMBIE) {
c010a306:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a309:	8b 00                	mov    (%eax),%eax
c010a30b:	83 f8 03             	cmp    $0x3,%eax
c010a30e:	75 1c                	jne    c010a32c <do_exit+0x18c>
                if (initproc->wait_state == WT_CHILD) {
c010a310:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010a315:	8b 40 6c             	mov    0x6c(%eax),%eax
c010a318:	3d 01 00 00 80       	cmp    $0x80000001,%eax
c010a31d:	75 0d                	jne    c010a32c <do_exit+0x18c>
                    wakeup_proc(initproc);
c010a31f:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010a324:	89 04 24             	mov    %eax,(%esp)
c010a327:	e8 46 0e 00 00       	call   c010b172 <wakeup_proc>
        while (current->cptr != NULL) {
c010a32c:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a331:	8b 40 70             	mov    0x70(%eax),%eax
c010a334:	85 c0                	test   %eax,%eax
c010a336:	0f 85 6a ff ff ff    	jne    c010a2a6 <do_exit+0x106>
                }
            }
        }
    }
    local_intr_restore(intr_flag);
c010a33c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a33f:	89 04 24             	mov    %eax,(%esp)
c010a342:	e8 da f1 ff ff       	call   c0109521 <__intr_restore>
    
    schedule();
c010a347:	e8 af 0e 00 00       	call   c010b1fb <schedule>
    panic("do_exit will not return!! %d.\n", current->pid);
c010a34c:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a351:	8b 40 04             	mov    0x4(%eax),%eax
c010a354:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010a358:	c7 44 24 08 9c e2 10 	movl   $0xc010e29c,0x8(%esp)
c010a35f:	c0 
c010a360:	c7 44 24 04 d9 01 00 	movl   $0x1d9,0x4(%esp)
c010a367:	00 
c010a368:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a36f:	e8 c9 60 ff ff       	call   c010043d <__panic>

c010a374 <load_icode>:
/* load_icode - load the content of binary program(ELF format) as the new content of current process
 * @binary:  the memory addr of the content of binary program
 * @size:  the size of the content of binary program
 */
static int
load_icode(unsigned char *binary, size_t size) {
c010a374:	f3 0f 1e fb          	endbr32 
c010a378:	55                   	push   %ebp
c010a379:	89 e5                	mov    %esp,%ebp
c010a37b:	83 ec 78             	sub    $0x78,%esp
    if (current->mm != NULL) {
c010a37e:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a383:	8b 40 18             	mov    0x18(%eax),%eax
c010a386:	85 c0                	test   %eax,%eax
c010a388:	74 1c                	je     c010a3a6 <load_icode+0x32>
        panic("load_icode: current->mm must be empty.\n");
c010a38a:	c7 44 24 08 bc e2 10 	movl   $0xc010e2bc,0x8(%esp)
c010a391:	c0 
c010a392:	c7 44 24 04 e3 01 00 	movl   $0x1e3,0x4(%esp)
c010a399:	00 
c010a39a:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a3a1:	e8 97 60 ff ff       	call   c010043d <__panic>
    }

    int ret = -E_NO_MEM;
c010a3a6:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)
    struct mm_struct *mm;
    //(1) create a new mm for current process
    if ((mm = mm_create()) == NULL) {
c010a3ad:	e8 3f b7 ff ff       	call   c0105af1 <mm_create>
c010a3b2:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010a3b5:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c010a3b9:	0f 84 0e 06 00 00    	je     c010a9cd <load_icode+0x659>
        goto bad_mm;
    }
    //(2) create a new PDT, and mm->pgdir= kernel virtual addr of PDT
    if (setup_pgdir(mm) != 0) {
c010a3bf:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a3c2:	89 04 24             	mov    %eax,(%esp)
c010a3c5:	e8 c2 f9 ff ff       	call   c0109d8c <setup_pgdir>
c010a3ca:	85 c0                	test   %eax,%eax
c010a3cc:	0f 85 ed 05 00 00    	jne    c010a9bf <load_icode+0x64b>
        goto bad_pgdir_cleanup_mm;
    }
    //(3) copy TEXT/DATA section, build BSS parts in binary to memory space of process
    struct Page *page;
    //(3.1) get the file header of the bianry program (ELF format)
    struct elfhdr *elf = (struct elfhdr *)binary;
c010a3d2:	8b 45 08             	mov    0x8(%ebp),%eax
c010a3d5:	89 45 cc             	mov    %eax,-0x34(%ebp)
    //(3.2) get the entry of the program section headers of the bianry program (ELF format)
    struct proghdr *ph = (struct proghdr *)(binary + elf->e_phoff);
c010a3d8:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010a3db:	8b 50 1c             	mov    0x1c(%eax),%edx
c010a3de:	8b 45 08             	mov    0x8(%ebp),%eax
c010a3e1:	01 d0                	add    %edx,%eax
c010a3e3:	89 45 ec             	mov    %eax,-0x14(%ebp)
    //(3.3) This program is valid?
    if (elf->e_magic != ELF_MAGIC) {
c010a3e6:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010a3e9:	8b 00                	mov    (%eax),%eax
c010a3eb:	3d 7f 45 4c 46       	cmp    $0x464c457f,%eax
c010a3f0:	74 0c                	je     c010a3fe <load_icode+0x8a>
        ret = -E_INVAL_ELF;
c010a3f2:	c7 45 f4 f8 ff ff ff 	movl   $0xfffffff8,-0xc(%ebp)
        goto bad_elf_cleanup_pgdir;
c010a3f9:	e9 b4 05 00 00       	jmp    c010a9b2 <load_icode+0x63e>
    }

    uint32_t vm_flags, perm;
    struct proghdr *ph_end = ph + elf->e_phnum;
c010a3fe:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010a401:	0f b7 40 2c          	movzwl 0x2c(%eax),%eax
c010a405:	c1 e0 05             	shl    $0x5,%eax
c010a408:	89 c2                	mov    %eax,%edx
c010a40a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a40d:	01 d0                	add    %edx,%eax
c010a40f:	89 45 c8             	mov    %eax,-0x38(%ebp)
    for (; ph < ph_end; ph ++) {
c010a412:	e9 01 03 00 00       	jmp    c010a718 <load_icode+0x3a4>
    //(3.4) find every program section headers
        if (ph->p_type != ELF_PT_LOAD) {
c010a417:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a41a:	8b 00                	mov    (%eax),%eax
c010a41c:	83 f8 01             	cmp    $0x1,%eax
c010a41f:	0f 85 e8 02 00 00    	jne    c010a70d <load_icode+0x399>
            continue ;
        }
        if (ph->p_filesz > ph->p_memsz) {
c010a425:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a428:	8b 50 10             	mov    0x10(%eax),%edx
c010a42b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a42e:	8b 40 14             	mov    0x14(%eax),%eax
c010a431:	39 c2                	cmp    %eax,%edx
c010a433:	76 0c                	jbe    c010a441 <load_icode+0xcd>
            ret = -E_INVAL_ELF;
c010a435:	c7 45 f4 f8 ff ff ff 	movl   $0xfffffff8,-0xc(%ebp)
            goto bad_cleanup_mmap;
c010a43c:	e9 66 05 00 00       	jmp    c010a9a7 <load_icode+0x633>
        }
        if (ph->p_filesz == 0) {
c010a441:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a444:	8b 40 10             	mov    0x10(%eax),%eax
c010a447:	85 c0                	test   %eax,%eax
c010a449:	0f 84 c1 02 00 00    	je     c010a710 <load_icode+0x39c>
            continue ;
        }
    //(3.5) call mm_map fun to setup the new vma ( ph->p_va, ph->p_memsz)
        vm_flags = 0, perm = PTE_U;
c010a44f:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c010a456:	c7 45 e4 04 00 00 00 	movl   $0x4,-0x1c(%ebp)
        if (ph->p_flags & ELF_PF_X) vm_flags |= VM_EXEC;
c010a45d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a460:	8b 40 18             	mov    0x18(%eax),%eax
c010a463:	83 e0 01             	and    $0x1,%eax
c010a466:	85 c0                	test   %eax,%eax
c010a468:	74 04                	je     c010a46e <load_icode+0xfa>
c010a46a:	83 4d e8 04          	orl    $0x4,-0x18(%ebp)
        if (ph->p_flags & ELF_PF_W) vm_flags |= VM_WRITE;
c010a46e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a471:	8b 40 18             	mov    0x18(%eax),%eax
c010a474:	83 e0 02             	and    $0x2,%eax
c010a477:	85 c0                	test   %eax,%eax
c010a479:	74 04                	je     c010a47f <load_icode+0x10b>
c010a47b:	83 4d e8 02          	orl    $0x2,-0x18(%ebp)
        if (ph->p_flags & ELF_PF_R) vm_flags |= VM_READ;
c010a47f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a482:	8b 40 18             	mov    0x18(%eax),%eax
c010a485:	83 e0 04             	and    $0x4,%eax
c010a488:	85 c0                	test   %eax,%eax
c010a48a:	74 04                	je     c010a490 <load_icode+0x11c>
c010a48c:	83 4d e8 01          	orl    $0x1,-0x18(%ebp)
        if (vm_flags & VM_WRITE) perm |= PTE_W;
c010a490:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a493:	83 e0 02             	and    $0x2,%eax
c010a496:	85 c0                	test   %eax,%eax
c010a498:	74 04                	je     c010a49e <load_icode+0x12a>
c010a49a:	83 4d e4 02          	orl    $0x2,-0x1c(%ebp)
        if ((ret = mm_map(mm, ph->p_va, ph->p_memsz, vm_flags, NULL)) != 0) {
c010a49e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a4a1:	8b 50 14             	mov    0x14(%eax),%edx
c010a4a4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a4a7:	8b 40 08             	mov    0x8(%eax),%eax
c010a4aa:	c7 44 24 10 00 00 00 	movl   $0x0,0x10(%esp)
c010a4b1:	00 
c010a4b2:	8b 4d e8             	mov    -0x18(%ebp),%ecx
c010a4b5:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c010a4b9:	89 54 24 08          	mov    %edx,0x8(%esp)
c010a4bd:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a4c1:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a4c4:	89 04 24             	mov    %eax,(%esp)
c010a4c7:	e8 3d ba ff ff       	call   c0105f09 <mm_map>
c010a4cc:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010a4cf:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010a4d3:	0f 85 c4 04 00 00    	jne    c010a99d <load_icode+0x629>
            goto bad_cleanup_mmap;
        }
        unsigned char *from = binary + ph->p_offset;
c010a4d9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a4dc:	8b 50 04             	mov    0x4(%eax),%edx
c010a4df:	8b 45 08             	mov    0x8(%ebp),%eax
c010a4e2:	01 d0                	add    %edx,%eax
c010a4e4:	89 45 e0             	mov    %eax,-0x20(%ebp)
        size_t off, size;
        uintptr_t start = ph->p_va, end, la = ROUNDDOWN(start, PGSIZE);
c010a4e7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a4ea:	8b 40 08             	mov    0x8(%eax),%eax
c010a4ed:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a4f0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a4f3:	89 45 b8             	mov    %eax,-0x48(%ebp)
c010a4f6:	8b 45 b8             	mov    -0x48(%ebp),%eax
c010a4f9:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010a4fe:	89 45 d4             	mov    %eax,-0x2c(%ebp)

        ret = -E_NO_MEM;
c010a501:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)

     //(3.6) alloc memory, and  copy the contents of every program section (from, from+end) to process's memory (la, la+end)
        end = ph->p_va + ph->p_filesz;
c010a508:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a50b:	8b 50 08             	mov    0x8(%eax),%edx
c010a50e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a511:	8b 40 10             	mov    0x10(%eax),%eax
c010a514:	01 d0                	add    %edx,%eax
c010a516:	89 45 b4             	mov    %eax,-0x4c(%ebp)
     //(3.6.1) copy TEXT/DATA section of bianry program
        while (start < end) {
c010a519:	e9 87 00 00 00       	jmp    c010a5a5 <load_icode+0x231>
            if ((page = pgdir_alloc_page(mm->pgdir, la, perm)) == NULL) {
c010a51e:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a521:	8b 40 0c             	mov    0xc(%eax),%eax
c010a524:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010a527:	89 54 24 08          	mov    %edx,0x8(%esp)
c010a52b:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010a52e:	89 54 24 04          	mov    %edx,0x4(%esp)
c010a532:	89 04 24             	mov    %eax,(%esp)
c010a535:	e8 9a a2 ff ff       	call   c01047d4 <pgdir_alloc_page>
c010a53a:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010a53d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010a541:	0f 84 59 04 00 00    	je     c010a9a0 <load_icode+0x62c>
                goto bad_cleanup_mmap;
            }
            off = start - la, size = PGSIZE - off, la += PGSIZE;
c010a547:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a54a:	2b 45 d4             	sub    -0x2c(%ebp),%eax
c010a54d:	89 45 b0             	mov    %eax,-0x50(%ebp)
c010a550:	b8 00 10 00 00       	mov    $0x1000,%eax
c010a555:	2b 45 b0             	sub    -0x50(%ebp),%eax
c010a558:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010a55b:	81 45 d4 00 10 00 00 	addl   $0x1000,-0x2c(%ebp)
            if (end < la) {
c010a562:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a565:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a568:	73 09                	jae    c010a573 <load_icode+0x1ff>
                size -= la - end;
c010a56a:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a56d:	2b 45 d4             	sub    -0x2c(%ebp),%eax
c010a570:	01 45 dc             	add    %eax,-0x24(%ebp)
            }
            memcpy(page2kva(page) + off, from, size);
c010a573:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a576:	89 04 24             	mov    %eax,(%esp)
c010a579:	e8 a5 f0 ff ff       	call   c0109623 <page2kva>
c010a57e:	8b 55 b0             	mov    -0x50(%ebp),%edx
c010a581:	01 c2                	add    %eax,%edx
c010a583:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a586:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a58a:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010a58d:	89 44 24 04          	mov    %eax,0x4(%esp)
c010a591:	89 14 24             	mov    %edx,(%esp)
c010a594:	e8 7e 13 00 00       	call   c010b917 <memcpy>
            start += size, from += size;
c010a599:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a59c:	01 45 d8             	add    %eax,-0x28(%ebp)
c010a59f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a5a2:	01 45 e0             	add    %eax,-0x20(%ebp)
        while (start < end) {
c010a5a5:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a5a8:	3b 45 b4             	cmp    -0x4c(%ebp),%eax
c010a5ab:	0f 82 6d ff ff ff    	jb     c010a51e <load_icode+0x1aa>
        }

      //(3.6.2) build BSS section of binary program
        end = ph->p_va + ph->p_memsz;
c010a5b1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a5b4:	8b 50 08             	mov    0x8(%eax),%edx
c010a5b7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a5ba:	8b 40 14             	mov    0x14(%eax),%eax
c010a5bd:	01 d0                	add    %edx,%eax
c010a5bf:	89 45 b4             	mov    %eax,-0x4c(%ebp)
        if (start < la) {
c010a5c2:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a5c5:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a5c8:	0f 83 31 01 00 00    	jae    c010a6ff <load_icode+0x38b>
            /* ph->p_memsz == ph->p_filesz */
            if (start == end) {
c010a5ce:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a5d1:	3b 45 b4             	cmp    -0x4c(%ebp),%eax
c010a5d4:	0f 84 39 01 00 00    	je     c010a713 <load_icode+0x39f>
                continue ;
            }
            off = start + PGSIZE - la, size = PGSIZE - off;
c010a5da:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a5dd:	2b 45 d4             	sub    -0x2c(%ebp),%eax
c010a5e0:	05 00 10 00 00       	add    $0x1000,%eax
c010a5e5:	89 45 b0             	mov    %eax,-0x50(%ebp)
c010a5e8:	b8 00 10 00 00       	mov    $0x1000,%eax
c010a5ed:	2b 45 b0             	sub    -0x50(%ebp),%eax
c010a5f0:	89 45 dc             	mov    %eax,-0x24(%ebp)
            if (end < la) {
c010a5f3:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a5f6:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a5f9:	73 09                	jae    c010a604 <load_icode+0x290>
                size -= la - end;
c010a5fb:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a5fe:	2b 45 d4             	sub    -0x2c(%ebp),%eax
c010a601:	01 45 dc             	add    %eax,-0x24(%ebp)
            }
            memset(page2kva(page) + off, 0, size);
c010a604:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a607:	89 04 24             	mov    %eax,(%esp)
c010a60a:	e8 14 f0 ff ff       	call   c0109623 <page2kva>
c010a60f:	8b 55 b0             	mov    -0x50(%ebp),%edx
c010a612:	01 c2                	add    %eax,%edx
c010a614:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a617:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a61b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010a622:	00 
c010a623:	89 14 24             	mov    %edx,(%esp)
c010a626:	e8 02 12 00 00       	call   c010b82d <memset>
            start += size;
c010a62b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a62e:	01 45 d8             	add    %eax,-0x28(%ebp)
            assert((end < la && start == end) || (end >= la && start == la));
c010a631:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a634:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a637:	73 0c                	jae    c010a645 <load_icode+0x2d1>
c010a639:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a63c:	3b 45 b4             	cmp    -0x4c(%ebp),%eax
c010a63f:	0f 84 ba 00 00 00    	je     c010a6ff <load_icode+0x38b>
c010a645:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a648:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a64b:	72 0c                	jb     c010a659 <load_icode+0x2e5>
c010a64d:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a650:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a653:	0f 84 a6 00 00 00    	je     c010a6ff <load_icode+0x38b>
c010a659:	c7 44 24 0c e4 e2 10 	movl   $0xc010e2e4,0xc(%esp)
c010a660:	c0 
c010a661:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010a668:	c0 
c010a669:	c7 44 24 04 35 02 00 	movl   $0x235,0x4(%esp)
c010a670:	00 
c010a671:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a678:	e8 c0 5d ff ff       	call   c010043d <__panic>
        }
        while (start < end) {
            if ((page = pgdir_alloc_page(mm->pgdir, la, perm)) == NULL) {
c010a67d:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a680:	8b 40 0c             	mov    0xc(%eax),%eax
c010a683:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010a686:	89 54 24 08          	mov    %edx,0x8(%esp)
c010a68a:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010a68d:	89 54 24 04          	mov    %edx,0x4(%esp)
c010a691:	89 04 24             	mov    %eax,(%esp)
c010a694:	e8 3b a1 ff ff       	call   c01047d4 <pgdir_alloc_page>
c010a699:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010a69c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010a6a0:	0f 84 fd 02 00 00    	je     c010a9a3 <load_icode+0x62f>
                goto bad_cleanup_mmap;
            }
            off = start - la, size = PGSIZE - off, la += PGSIZE;
c010a6a6:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a6a9:	2b 45 d4             	sub    -0x2c(%ebp),%eax
c010a6ac:	89 45 b0             	mov    %eax,-0x50(%ebp)
c010a6af:	b8 00 10 00 00       	mov    $0x1000,%eax
c010a6b4:	2b 45 b0             	sub    -0x50(%ebp),%eax
c010a6b7:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010a6ba:	81 45 d4 00 10 00 00 	addl   $0x1000,-0x2c(%ebp)
            if (end < la) {
c010a6c1:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a6c4:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010a6c7:	73 09                	jae    c010a6d2 <load_icode+0x35e>
                size -= la - end;
c010a6c9:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010a6cc:	2b 45 d4             	sub    -0x2c(%ebp),%eax
c010a6cf:	01 45 dc             	add    %eax,-0x24(%ebp)
            }
            memset(page2kva(page) + off, 0, size);
c010a6d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010a6d5:	89 04 24             	mov    %eax,(%esp)
c010a6d8:	e8 46 ef ff ff       	call   c0109623 <page2kva>
c010a6dd:	8b 55 b0             	mov    -0x50(%ebp),%edx
c010a6e0:	01 c2                	add    %eax,%edx
c010a6e2:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a6e5:	89 44 24 08          	mov    %eax,0x8(%esp)
c010a6e9:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010a6f0:	00 
c010a6f1:	89 14 24             	mov    %edx,(%esp)
c010a6f4:	e8 34 11 00 00       	call   c010b82d <memset>
            start += size;
c010a6f9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010a6fc:	01 45 d8             	add    %eax,-0x28(%ebp)
        while (start < end) {
c010a6ff:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a702:	3b 45 b4             	cmp    -0x4c(%ebp),%eax
c010a705:	0f 82 72 ff ff ff    	jb     c010a67d <load_icode+0x309>
c010a70b:	eb 07                	jmp    c010a714 <load_icode+0x3a0>
            continue ;
c010a70d:	90                   	nop
c010a70e:	eb 04                	jmp    c010a714 <load_icode+0x3a0>
            continue ;
c010a710:	90                   	nop
c010a711:	eb 01                	jmp    c010a714 <load_icode+0x3a0>
                continue ;
c010a713:	90                   	nop
    for (; ph < ph_end; ph ++) {
c010a714:	83 45 ec 20          	addl   $0x20,-0x14(%ebp)
c010a718:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010a71b:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c010a71e:	0f 82 f3 fc ff ff    	jb     c010a417 <load_icode+0xa3>
        }
    }
    //(4) build user stack memory
    vm_flags = VM_READ | VM_WRITE | VM_STACK;
c010a724:	c7 45 e8 0b 00 00 00 	movl   $0xb,-0x18(%ebp)
    if ((ret = mm_map(mm, USTACKTOP - USTACKSIZE, USTACKSIZE, vm_flags, NULL)) != 0) {
c010a72b:	c7 44 24 10 00 00 00 	movl   $0x0,0x10(%esp)
c010a732:	00 
c010a733:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a736:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010a73a:	c7 44 24 08 00 00 10 	movl   $0x100000,0x8(%esp)
c010a741:	00 
c010a742:	c7 44 24 04 00 00 f0 	movl   $0xaff00000,0x4(%esp)
c010a749:	af 
c010a74a:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a74d:	89 04 24             	mov    %eax,(%esp)
c010a750:	e8 b4 b7 ff ff       	call   c0105f09 <mm_map>
c010a755:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010a758:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010a75c:	0f 85 44 02 00 00    	jne    c010a9a6 <load_icode+0x632>
        goto bad_cleanup_mmap;
    }
    assert(pgdir_alloc_page(mm->pgdir, USTACKTOP-PGSIZE , PTE_USER) != NULL);
c010a762:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a765:	8b 40 0c             	mov    0xc(%eax),%eax
c010a768:	c7 44 24 08 07 00 00 	movl   $0x7,0x8(%esp)
c010a76f:	00 
c010a770:	c7 44 24 04 00 f0 ff 	movl   $0xaffff000,0x4(%esp)
c010a777:	af 
c010a778:	89 04 24             	mov    %eax,(%esp)
c010a77b:	e8 54 a0 ff ff       	call   c01047d4 <pgdir_alloc_page>
c010a780:	85 c0                	test   %eax,%eax
c010a782:	75 24                	jne    c010a7a8 <load_icode+0x434>
c010a784:	c7 44 24 0c 20 e3 10 	movl   $0xc010e320,0xc(%esp)
c010a78b:	c0 
c010a78c:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010a793:	c0 
c010a794:	c7 44 24 04 48 02 00 	movl   $0x248,0x4(%esp)
c010a79b:	00 
c010a79c:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a7a3:	e8 95 5c ff ff       	call   c010043d <__panic>
    assert(pgdir_alloc_page(mm->pgdir, USTACKTOP-2*PGSIZE , PTE_USER) != NULL);
c010a7a8:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a7ab:	8b 40 0c             	mov    0xc(%eax),%eax
c010a7ae:	c7 44 24 08 07 00 00 	movl   $0x7,0x8(%esp)
c010a7b5:	00 
c010a7b6:	c7 44 24 04 00 e0 ff 	movl   $0xafffe000,0x4(%esp)
c010a7bd:	af 
c010a7be:	89 04 24             	mov    %eax,(%esp)
c010a7c1:	e8 0e a0 ff ff       	call   c01047d4 <pgdir_alloc_page>
c010a7c6:	85 c0                	test   %eax,%eax
c010a7c8:	75 24                	jne    c010a7ee <load_icode+0x47a>
c010a7ca:	c7 44 24 0c 64 e3 10 	movl   $0xc010e364,0xc(%esp)
c010a7d1:	c0 
c010a7d2:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010a7d9:	c0 
c010a7da:	c7 44 24 04 49 02 00 	movl   $0x249,0x4(%esp)
c010a7e1:	00 
c010a7e2:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a7e9:	e8 4f 5c ff ff       	call   c010043d <__panic>
    assert(pgdir_alloc_page(mm->pgdir, USTACKTOP-3*PGSIZE , PTE_USER) != NULL);
c010a7ee:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a7f1:	8b 40 0c             	mov    0xc(%eax),%eax
c010a7f4:	c7 44 24 08 07 00 00 	movl   $0x7,0x8(%esp)
c010a7fb:	00 
c010a7fc:	c7 44 24 04 00 d0 ff 	movl   $0xafffd000,0x4(%esp)
c010a803:	af 
c010a804:	89 04 24             	mov    %eax,(%esp)
c010a807:	e8 c8 9f ff ff       	call   c01047d4 <pgdir_alloc_page>
c010a80c:	85 c0                	test   %eax,%eax
c010a80e:	75 24                	jne    c010a834 <load_icode+0x4c0>
c010a810:	c7 44 24 0c a8 e3 10 	movl   $0xc010e3a8,0xc(%esp)
c010a817:	c0 
c010a818:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010a81f:	c0 
c010a820:	c7 44 24 04 4a 02 00 	movl   $0x24a,0x4(%esp)
c010a827:	00 
c010a828:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a82f:	e8 09 5c ff ff       	call   c010043d <__panic>
    assert(pgdir_alloc_page(mm->pgdir, USTACKTOP-4*PGSIZE , PTE_USER) != NULL);
c010a834:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a837:	8b 40 0c             	mov    0xc(%eax),%eax
c010a83a:	c7 44 24 08 07 00 00 	movl   $0x7,0x8(%esp)
c010a841:	00 
c010a842:	c7 44 24 04 00 c0 ff 	movl   $0xafffc000,0x4(%esp)
c010a849:	af 
c010a84a:	89 04 24             	mov    %eax,(%esp)
c010a84d:	e8 82 9f ff ff       	call   c01047d4 <pgdir_alloc_page>
c010a852:	85 c0                	test   %eax,%eax
c010a854:	75 24                	jne    c010a87a <load_icode+0x506>
c010a856:	c7 44 24 0c ec e3 10 	movl   $0xc010e3ec,0xc(%esp)
c010a85d:	c0 
c010a85e:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010a865:	c0 
c010a866:	c7 44 24 04 4b 02 00 	movl   $0x24b,0x4(%esp)
c010a86d:	00 
c010a86e:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a875:	e8 c3 5b ff ff       	call   c010043d <__panic>
    
    //(5) set current process's mm, sr3, and set CR3 reg = physical addr of Page Directory
    mm_count_inc(mm);
c010a87a:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a87d:	89 04 24             	mov    %eax,(%esp)
c010a880:	e8 3c ee ff ff       	call   c01096c1 <mm_count_inc>
    current->mm = mm;
c010a885:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a88a:	8b 55 d0             	mov    -0x30(%ebp),%edx
c010a88d:	89 50 18             	mov    %edx,0x18(%eax)
    current->cr3 = PADDR(mm->pgdir);
c010a890:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a893:	8b 40 0c             	mov    0xc(%eax),%eax
c010a896:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c010a899:	81 7d c4 ff ff ff bf 	cmpl   $0xbfffffff,-0x3c(%ebp)
c010a8a0:	77 23                	ja     c010a8c5 <load_icode+0x551>
c010a8a2:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010a8a5:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010a8a9:	c7 44 24 08 18 e2 10 	movl   $0xc010e218,0x8(%esp)
c010a8b0:	c0 
c010a8b1:	c7 44 24 04 50 02 00 	movl   $0x250,0x4(%esp)
c010a8b8:	00 
c010a8b9:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a8c0:	e8 78 5b ff ff       	call   c010043d <__panic>
c010a8c5:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010a8c8:	8d 90 00 00 00 40    	lea    0x40000000(%eax),%edx
c010a8ce:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a8d3:	89 50 40             	mov    %edx,0x40(%eax)
    lcr3(PADDR(mm->pgdir));
c010a8d6:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a8d9:	8b 40 0c             	mov    0xc(%eax),%eax
c010a8dc:	89 45 c0             	mov    %eax,-0x40(%ebp)
c010a8df:	81 7d c0 ff ff ff bf 	cmpl   $0xbfffffff,-0x40(%ebp)
c010a8e6:	77 23                	ja     c010a90b <load_icode+0x597>
c010a8e8:	8b 45 c0             	mov    -0x40(%ebp),%eax
c010a8eb:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010a8ef:	c7 44 24 08 18 e2 10 	movl   $0xc010e218,0x8(%esp)
c010a8f6:	c0 
c010a8f7:	c7 44 24 04 51 02 00 	movl   $0x251,0x4(%esp)
c010a8fe:	00 
c010a8ff:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010a906:	e8 32 5b ff ff       	call   c010043d <__panic>
c010a90b:	8b 45 c0             	mov    -0x40(%ebp),%eax
c010a90e:	05 00 00 00 40       	add    $0x40000000,%eax
c010a913:	89 45 ac             	mov    %eax,-0x54(%ebp)
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c010a916:	8b 45 ac             	mov    -0x54(%ebp),%eax
c010a919:	0f 22 d8             	mov    %eax,%cr3
}
c010a91c:	90                   	nop

    //(6) setup trapframe for user environment
    struct trapframe *tf = current->tf;
c010a91d:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a922:	8b 40 3c             	mov    0x3c(%eax),%eax
c010a925:	89 45 bc             	mov    %eax,-0x44(%ebp)
    memset(tf, 0, sizeof(struct trapframe));
c010a928:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
c010a92f:	00 
c010a930:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010a937:	00 
c010a938:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a93b:	89 04 24             	mov    %eax,(%esp)
c010a93e:	e8 ea 0e 00 00       	call   c010b82d <memset>
     *          tf_ds=tf_es=tf_ss should be USER_DS segment
     *          tf_esp should be the top addr of user stack (USTACKTOP)
     *          tf_eip should be the entry point of this binary program (elf->e_entry)
     *          tf_eflags should be set to enable computer to produce Interrupt
     */
    tf->tf_cs=USER_CS;
c010a943:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a946:	66 c7 40 3c 1b 00    	movw   $0x1b,0x3c(%eax)
    tf->tf_ds=tf->tf_es=tf->tf_ss=USER_DS;
c010a94c:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a94f:	66 c7 40 48 23 00    	movw   $0x23,0x48(%eax)
c010a955:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a958:	0f b7 50 48          	movzwl 0x48(%eax),%edx
c010a95c:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a95f:	66 89 50 28          	mov    %dx,0x28(%eax)
c010a963:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a966:	0f b7 50 28          	movzwl 0x28(%eax),%edx
c010a96a:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a96d:	66 89 50 2c          	mov    %dx,0x2c(%eax)
    tf->tf_esp=USTACKTOP;
c010a971:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a974:	c7 40 44 00 00 00 b0 	movl   $0xb0000000,0x44(%eax)
    tf->tf_eip=elf->e_entry;
c010a97b:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010a97e:	8b 50 18             	mov    0x18(%eax),%edx
c010a981:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a984:	89 50 38             	mov    %edx,0x38(%eax)
    tf->tf_eflags=FL_IF;
c010a987:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010a98a:	c7 40 40 00 02 00 00 	movl   $0x200,0x40(%eax)
    ret = 0;
c010a991:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
out:
    return ret;
c010a998:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010a99b:	eb 37                	jmp    c010a9d4 <load_icode+0x660>
            goto bad_cleanup_mmap;
c010a99d:	90                   	nop
c010a99e:	eb 07                	jmp    c010a9a7 <load_icode+0x633>
                goto bad_cleanup_mmap;
c010a9a0:	90                   	nop
c010a9a1:	eb 04                	jmp    c010a9a7 <load_icode+0x633>
                goto bad_cleanup_mmap;
c010a9a3:	90                   	nop
c010a9a4:	eb 01                	jmp    c010a9a7 <load_icode+0x633>
        goto bad_cleanup_mmap;
c010a9a6:	90                   	nop
bad_cleanup_mmap:
    exit_mmap(mm);
c010a9a7:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a9aa:	89 04 24             	mov    %eax,(%esp)
c010a9ad:	e8 78 b7 ff ff       	call   c010612a <exit_mmap>
bad_elf_cleanup_pgdir:
    put_pgdir(mm);
c010a9b2:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a9b5:	89 04 24             	mov    %eax,(%esp)
c010a9b8:	e8 7a f4 ff ff       	call   c0109e37 <put_pgdir>
c010a9bd:	eb 01                	jmp    c010a9c0 <load_icode+0x64c>
        goto bad_pgdir_cleanup_mm;
c010a9bf:	90                   	nop
bad_pgdir_cleanup_mm:
    mm_destroy(mm);
c010a9c0:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010a9c3:	89 04 24             	mov    %eax,(%esp)
c010a9c6:	e8 95 b4 ff ff       	call   c0105e60 <mm_destroy>
bad_mm:
    goto out;
c010a9cb:	eb cb                	jmp    c010a998 <load_icode+0x624>
        goto bad_mm;
c010a9cd:	90                   	nop
c010a9ce:	f3 0f 1e fb          	endbr32 
    goto out;
c010a9d2:	eb c4                	jmp    c010a998 <load_icode+0x624>
}
c010a9d4:	c9                   	leave  
c010a9d5:	c3                   	ret    

c010a9d6 <do_execve>:

// do_execve - call exit_mmap(mm)&put_pgdir(mm) to reclaim memory space of current process
//           - call load_icode to setup new memory space accroding binary prog.
int
do_execve(const char *name, size_t len, unsigned char *binary, size_t size) {
c010a9d6:	f3 0f 1e fb          	endbr32 
c010a9da:	55                   	push   %ebp
c010a9db:	89 e5                	mov    %esp,%ebp
c010a9dd:	83 ec 38             	sub    $0x38,%esp
    struct mm_struct *mm = current->mm;
c010a9e0:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010a9e5:	8b 40 18             	mov    0x18(%eax),%eax
c010a9e8:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (!user_mem_check(mm, (uintptr_t)name, len, 0)) {
c010a9eb:	8b 45 08             	mov    0x8(%ebp),%eax
c010a9ee:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010a9f5:	00 
c010a9f6:	8b 55 0c             	mov    0xc(%ebp),%edx
c010a9f9:	89 54 24 08          	mov    %edx,0x8(%esp)
c010a9fd:	89 44 24 04          	mov    %eax,0x4(%esp)
c010aa01:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010aa04:	89 04 24             	mov    %eax,(%esp)
c010aa07:	e8 b6 c1 ff ff       	call   c0106bc2 <user_mem_check>
c010aa0c:	85 c0                	test   %eax,%eax
c010aa0e:	75 0a                	jne    c010aa1a <do_execve+0x44>
        return -E_INVAL;
c010aa10:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c010aa15:	e9 fb 00 00 00       	jmp    c010ab15 <do_execve+0x13f>
    }
    if (len > PROC_NAME_LEN) {
c010aa1a:	83 7d 0c 0f          	cmpl   $0xf,0xc(%ebp)
c010aa1e:	76 07                	jbe    c010aa27 <do_execve+0x51>
        len = PROC_NAME_LEN;
c010aa20:	c7 45 0c 0f 00 00 00 	movl   $0xf,0xc(%ebp)
    }

    char local_name[PROC_NAME_LEN + 1];
    memset(local_name, 0, sizeof(local_name));
c010aa27:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c010aa2e:	00 
c010aa2f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010aa36:	00 
c010aa37:	8d 45 dc             	lea    -0x24(%ebp),%eax
c010aa3a:	89 04 24             	mov    %eax,(%esp)
c010aa3d:	e8 eb 0d 00 00       	call   c010b82d <memset>
    memcpy(local_name, name, len);
c010aa42:	8b 45 0c             	mov    0xc(%ebp),%eax
c010aa45:	89 44 24 08          	mov    %eax,0x8(%esp)
c010aa49:	8b 45 08             	mov    0x8(%ebp),%eax
c010aa4c:	89 44 24 04          	mov    %eax,0x4(%esp)
c010aa50:	8d 45 dc             	lea    -0x24(%ebp),%eax
c010aa53:	89 04 24             	mov    %eax,(%esp)
c010aa56:	e8 bc 0e 00 00       	call   c010b917 <memcpy>

    if (mm != NULL) {
c010aa5b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010aa5f:	74 4b                	je     c010aaac <do_execve+0xd6>
        lcr3(boot_cr3);
c010aa61:	a1 5c 40 1b c0       	mov    0xc01b405c,%eax
c010aa66:	89 45 ec             	mov    %eax,-0x14(%ebp)
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c010aa69:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010aa6c:	0f 22 d8             	mov    %eax,%cr3
}
c010aa6f:	90                   	nop
        if (mm_count_dec(mm) == 0) {
c010aa70:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010aa73:	89 04 24             	mov    %eax,(%esp)
c010aa76:	e8 60 ec ff ff       	call   c01096db <mm_count_dec>
c010aa7b:	85 c0                	test   %eax,%eax
c010aa7d:	75 21                	jne    c010aaa0 <do_execve+0xca>
            exit_mmap(mm);
c010aa7f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010aa82:	89 04 24             	mov    %eax,(%esp)
c010aa85:	e8 a0 b6 ff ff       	call   c010612a <exit_mmap>
            put_pgdir(mm);
c010aa8a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010aa8d:	89 04 24             	mov    %eax,(%esp)
c010aa90:	e8 a2 f3 ff ff       	call   c0109e37 <put_pgdir>
            mm_destroy(mm);
c010aa95:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010aa98:	89 04 24             	mov    %eax,(%esp)
c010aa9b:	e8 c0 b3 ff ff       	call   c0105e60 <mm_destroy>
        }
        current->mm = NULL;
c010aaa0:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010aaa5:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
    }
    int ret;
    if ((ret = load_icode(binary, size)) != 0) {
c010aaac:	8b 45 14             	mov    0x14(%ebp),%eax
c010aaaf:	89 44 24 04          	mov    %eax,0x4(%esp)
c010aab3:	8b 45 10             	mov    0x10(%ebp),%eax
c010aab6:	89 04 24             	mov    %eax,(%esp)
c010aab9:	e8 b6 f8 ff ff       	call   c010a374 <load_icode>
c010aabe:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010aac1:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010aac5:	75 1b                	jne    c010aae2 <do_execve+0x10c>
        goto execve_exit;
    }
    set_proc_name(current, local_name);
c010aac7:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010aacc:	8d 55 dc             	lea    -0x24(%ebp),%edx
c010aacf:	89 54 24 04          	mov    %edx,0x4(%esp)
c010aad3:	89 04 24             	mov    %eax,(%esp)
c010aad6:	e8 49 ed ff ff       	call   c0109824 <set_proc_name>
    return 0;
c010aadb:	b8 00 00 00 00       	mov    $0x0,%eax
c010aae0:	eb 33                	jmp    c010ab15 <do_execve+0x13f>
        goto execve_exit;
c010aae2:	90                   	nop
c010aae3:	f3 0f 1e fb          	endbr32 

execve_exit:
    do_exit(ret);
c010aae7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010aaea:	89 04 24             	mov    %eax,(%esp)
c010aaed:	e8 ae f6 ff ff       	call   c010a1a0 <do_exit>
    panic("already exit: %e.\n", ret);
c010aaf2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010aaf5:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010aaf9:	c7 44 24 08 2f e4 10 	movl   $0xc010e42f,0x8(%esp)
c010ab00:	c0 
c010ab01:	c7 44 24 04 93 02 00 	movl   $0x293,0x4(%esp)
c010ab08:	00 
c010ab09:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010ab10:	e8 28 59 ff ff       	call   c010043d <__panic>
}
c010ab15:	c9                   	leave  
c010ab16:	c3                   	ret    

c010ab17 <do_yield>:

// do_yield - ask the scheduler to reschedule
int
do_yield(void) {
c010ab17:	f3 0f 1e fb          	endbr32 
c010ab1b:	55                   	push   %ebp
c010ab1c:	89 e5                	mov    %esp,%ebp
    current->need_resched = 1;
c010ab1e:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010ab23:	c7 40 10 01 00 00 00 	movl   $0x1,0x10(%eax)
    return 0;
c010ab2a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010ab2f:	5d                   	pop    %ebp
c010ab30:	c3                   	ret    

c010ab31 <do_wait>:

// do_wait - wait one OR any children with PROC_ZOMBIE state, and free memory space of kernel stack
//         - proc struct of this child.
// NOTE: only after do_wait function, all resources of the child proces are free.
int
do_wait(int pid, int *code_store) {
c010ab31:	f3 0f 1e fb          	endbr32 
c010ab35:	55                   	push   %ebp
c010ab36:	89 e5                	mov    %esp,%ebp
c010ab38:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm = current->mm;
c010ab3b:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010ab40:	8b 40 18             	mov    0x18(%eax),%eax
c010ab43:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if (code_store != NULL) {
c010ab46:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010ab4a:	74 30                	je     c010ab7c <do_wait+0x4b>
        if (!user_mem_check(mm, (uintptr_t)code_store, sizeof(int), 1)) {
c010ab4c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ab4f:	c7 44 24 0c 01 00 00 	movl   $0x1,0xc(%esp)
c010ab56:	00 
c010ab57:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
c010ab5e:	00 
c010ab5f:	89 44 24 04          	mov    %eax,0x4(%esp)
c010ab63:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010ab66:	89 04 24             	mov    %eax,(%esp)
c010ab69:	e8 54 c0 ff ff       	call   c0106bc2 <user_mem_check>
c010ab6e:	85 c0                	test   %eax,%eax
c010ab70:	75 0a                	jne    c010ab7c <do_wait+0x4b>
            return -E_INVAL;
c010ab72:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c010ab77:	e9 47 01 00 00       	jmp    c010acc3 <do_wait+0x192>
        }
    }

    struct proc_struct *proc;
    bool intr_flag, haskid;
repeat:
c010ab7c:	90                   	nop
    haskid = 0;
c010ab7d:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    if (pid != 0) {
c010ab84:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010ab88:	74 36                	je     c010abc0 <do_wait+0x8f>
        proc = find_proc(pid);
c010ab8a:	8b 45 08             	mov    0x8(%ebp),%eax
c010ab8d:	89 04 24             	mov    %eax,(%esp)
c010ab90:	e8 9e f0 ff ff       	call   c0109c33 <find_proc>
c010ab95:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (proc != NULL && proc->parent == current) {
c010ab98:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010ab9c:	74 4f                	je     c010abed <do_wait+0xbc>
c010ab9e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010aba1:	8b 50 14             	mov    0x14(%eax),%edx
c010aba4:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010aba9:	39 c2                	cmp    %eax,%edx
c010abab:	75 40                	jne    c010abed <do_wait+0xbc>
            haskid = 1;
c010abad:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
            if (proc->state == PROC_ZOMBIE) {
c010abb4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010abb7:	8b 00                	mov    (%eax),%eax
c010abb9:	83 f8 03             	cmp    $0x3,%eax
c010abbc:	75 2f                	jne    c010abed <do_wait+0xbc>
                goto found;
c010abbe:	eb 7e                	jmp    c010ac3e <do_wait+0x10d>
            }
        }
    }
    else {
        proc = current->cptr;
c010abc0:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010abc5:	8b 40 70             	mov    0x70(%eax),%eax
c010abc8:	89 45 f4             	mov    %eax,-0xc(%ebp)
        for (; proc != NULL; proc = proc->optr) {
c010abcb:	eb 1a                	jmp    c010abe7 <do_wait+0xb6>
            haskid = 1;
c010abcd:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
            if (proc->state == PROC_ZOMBIE) {
c010abd4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010abd7:	8b 00                	mov    (%eax),%eax
c010abd9:	83 f8 03             	cmp    $0x3,%eax
c010abdc:	74 5f                	je     c010ac3d <do_wait+0x10c>
        for (; proc != NULL; proc = proc->optr) {
c010abde:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010abe1:	8b 40 78             	mov    0x78(%eax),%eax
c010abe4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010abe7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010abeb:	75 e0                	jne    c010abcd <do_wait+0x9c>
                goto found;
            }
        }
    }
    if (haskid) {
c010abed:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010abf1:	74 40                	je     c010ac33 <do_wait+0x102>
        current->state = PROC_SLEEPING;
c010abf3:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010abf8:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
        current->wait_state = WT_CHILD;
c010abfe:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010ac03:	c7 40 6c 01 00 00 80 	movl   $0x80000001,0x6c(%eax)
        schedule();
c010ac0a:	e8 ec 05 00 00       	call   c010b1fb <schedule>
        if (current->flags & PF_EXITING) {
c010ac0f:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010ac14:	8b 40 44             	mov    0x44(%eax),%eax
c010ac17:	83 e0 01             	and    $0x1,%eax
c010ac1a:	85 c0                	test   %eax,%eax
c010ac1c:	0f 84 5b ff ff ff    	je     c010ab7d <do_wait+0x4c>
            do_exit(-E_KILLED);
c010ac22:	c7 04 24 f7 ff ff ff 	movl   $0xfffffff7,(%esp)
c010ac29:	e8 72 f5 ff ff       	call   c010a1a0 <do_exit>
        }
        goto repeat;
c010ac2e:	e9 4a ff ff ff       	jmp    c010ab7d <do_wait+0x4c>
    }
    return -E_BAD_PROC;
c010ac33:	b8 fe ff ff ff       	mov    $0xfffffffe,%eax
c010ac38:	e9 86 00 00 00       	jmp    c010acc3 <do_wait+0x192>
                goto found;
c010ac3d:	90                   	nop

found:
    if (proc == idleproc || proc == initproc) {
c010ac3e:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010ac43:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c010ac46:	74 0a                	je     c010ac52 <do_wait+0x121>
c010ac48:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010ac4d:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c010ac50:	75 1c                	jne    c010ac6e <do_wait+0x13d>
        panic("wait idleproc or initproc.\n");
c010ac52:	c7 44 24 08 42 e4 10 	movl   $0xc010e442,0x8(%esp)
c010ac59:	c0 
c010ac5a:	c7 44 24 04 cc 02 00 	movl   $0x2cc,0x4(%esp)
c010ac61:	00 
c010ac62:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010ac69:	e8 cf 57 ff ff       	call   c010043d <__panic>
    }
    if (code_store != NULL) {
c010ac6e:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010ac72:	74 0b                	je     c010ac7f <do_wait+0x14e>
        *code_store = proc->exit_code;
c010ac74:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010ac77:	8b 50 68             	mov    0x68(%eax),%edx
c010ac7a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ac7d:	89 10                	mov    %edx,(%eax)
    }
    local_intr_save(intr_flag);
c010ac7f:	e8 73 e8 ff ff       	call   c01094f7 <__intr_save>
c010ac84:	89 45 e8             	mov    %eax,-0x18(%ebp)
    {
        unhash_proc(proc);
c010ac87:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010ac8a:	89 04 24             	mov    %eax,(%esp)
c010ac8d:	e8 67 ef ff ff       	call   c0109bf9 <unhash_proc>
        remove_links(proc);
c010ac92:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010ac95:	89 04 24             	mov    %eax,(%esp)
c010ac98:	e8 bf ec ff ff       	call   c010995c <remove_links>
    }
    local_intr_restore(intr_flag);
c010ac9d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010aca0:	89 04 24             	mov    %eax,(%esp)
c010aca3:	e8 79 e8 ff ff       	call   c0109521 <__intr_restore>
    put_kstack(proc);
c010aca8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010acab:	89 04 24             	mov    %eax,(%esp)
c010acae:	e8 ae f0 ff ff       	call   c0109d61 <put_kstack>
    kfree(proc);
c010acb3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010acb6:	89 04 24             	mov    %eax,(%esp)
c010acb9:	e8 6a c6 ff ff       	call   c0107328 <kfree>
    return 0;
c010acbe:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010acc3:	c9                   	leave  
c010acc4:	c3                   	ret    

c010acc5 <do_kill>:

// do_kill - kill process with pid by set this process's flags with PF_EXITING
int
do_kill(int pid) {
c010acc5:	f3 0f 1e fb          	endbr32 
c010acc9:	55                   	push   %ebp
c010acca:	89 e5                	mov    %esp,%ebp
c010accc:	83 ec 28             	sub    $0x28,%esp
    struct proc_struct *proc;
    if ((proc = find_proc(pid)) != NULL) {
c010accf:	8b 45 08             	mov    0x8(%ebp),%eax
c010acd2:	89 04 24             	mov    %eax,(%esp)
c010acd5:	e8 59 ef ff ff       	call   c0109c33 <find_proc>
c010acda:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010acdd:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010ace1:	74 41                	je     c010ad24 <do_kill+0x5f>
        if (!(proc->flags & PF_EXITING)) {
c010ace3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010ace6:	8b 40 44             	mov    0x44(%eax),%eax
c010ace9:	83 e0 01             	and    $0x1,%eax
c010acec:	85 c0                	test   %eax,%eax
c010acee:	75 2d                	jne    c010ad1d <do_kill+0x58>
            proc->flags |= PF_EXITING;
c010acf0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010acf3:	8b 40 44             	mov    0x44(%eax),%eax
c010acf6:	83 c8 01             	or     $0x1,%eax
c010acf9:	89 c2                	mov    %eax,%edx
c010acfb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010acfe:	89 50 44             	mov    %edx,0x44(%eax)
            if (proc->wait_state & WT_INTERRUPTED) {
c010ad01:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010ad04:	8b 40 6c             	mov    0x6c(%eax),%eax
c010ad07:	85 c0                	test   %eax,%eax
c010ad09:	79 0b                	jns    c010ad16 <do_kill+0x51>
                wakeup_proc(proc);
c010ad0b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010ad0e:	89 04 24             	mov    %eax,(%esp)
c010ad11:	e8 5c 04 00 00       	call   c010b172 <wakeup_proc>
            }
            return 0;
c010ad16:	b8 00 00 00 00       	mov    $0x0,%eax
c010ad1b:	eb 0c                	jmp    c010ad29 <do_kill+0x64>
        }
        return -E_KILLED;
c010ad1d:	b8 f7 ff ff ff       	mov    $0xfffffff7,%eax
c010ad22:	eb 05                	jmp    c010ad29 <do_kill+0x64>
    }
    return -E_INVAL;
c010ad24:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
c010ad29:	c9                   	leave  
c010ad2a:	c3                   	ret    

c010ad2b <kernel_execve>:

// kernel_execve - do SYS_exec syscall to exec a user program called by user_main kernel_thread
static int
kernel_execve(const char *name, unsigned char *binary, size_t size) {
c010ad2b:	f3 0f 1e fb          	endbr32 
c010ad2f:	55                   	push   %ebp
c010ad30:	89 e5                	mov    %esp,%ebp
c010ad32:	57                   	push   %edi
c010ad33:	56                   	push   %esi
c010ad34:	53                   	push   %ebx
c010ad35:	83 ec 2c             	sub    $0x2c,%esp
    int ret, len = strlen(name);
c010ad38:	8b 45 08             	mov    0x8(%ebp),%eax
c010ad3b:	89 04 24             	mov    %eax,(%esp)
c010ad3e:	e8 a8 07 00 00       	call   c010b4eb <strlen>
c010ad43:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    asm volatile (
c010ad46:	b8 04 00 00 00       	mov    $0x4,%eax
c010ad4b:	8b 55 08             	mov    0x8(%ebp),%edx
c010ad4e:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
c010ad51:	8b 5d 0c             	mov    0xc(%ebp),%ebx
c010ad54:	8b 75 10             	mov    0x10(%ebp),%esi
c010ad57:	89 f7                	mov    %esi,%edi
c010ad59:	cd 80                	int    $0x80
c010ad5b:	89 45 e0             	mov    %eax,-0x20(%ebp)
        "int %1;"
        : "=a" (ret)
        : "i" (T_SYSCALL), "0" (SYS_exec), "d" (name), "c" (len), "b" (binary), "D" (size)
        : "memory");
    return ret;
c010ad5e:	8b 45 e0             	mov    -0x20(%ebp),%eax
}
c010ad61:	83 c4 2c             	add    $0x2c,%esp
c010ad64:	5b                   	pop    %ebx
c010ad65:	5e                   	pop    %esi
c010ad66:	5f                   	pop    %edi
c010ad67:	5d                   	pop    %ebp
c010ad68:	c3                   	ret    

c010ad69 <user_main>:

#define KERNEL_EXECVE2(x, xstart, xsize)        __KERNEL_EXECVE2(x, xstart, xsize)

// user_main - kernel thread used to exec a user program
static int
user_main(void *arg) {
c010ad69:	f3 0f 1e fb          	endbr32 
c010ad6d:	55                   	push   %ebp
c010ad6e:	89 e5                	mov    %esp,%ebp
c010ad70:	83 ec 18             	sub    $0x18,%esp
#ifdef TEST
    KERNEL_EXECVE2(TEST, TESTSTART, TESTSIZE);
c010ad73:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010ad78:	8b 40 04             	mov    0x4(%eax),%eax
c010ad7b:	c7 44 24 08 5e e4 10 	movl   $0xc010e45e,0x8(%esp)
c010ad82:	c0 
c010ad83:	89 44 24 04          	mov    %eax,0x4(%esp)
c010ad87:	c7 04 24 68 e4 10 c0 	movl   $0xc010e468,(%esp)
c010ad8e:	e8 3e 55 ff ff       	call   c01002d1 <cprintf>
c010ad93:	b8 8c 88 00 00       	mov    $0x888c,%eax
c010ad98:	89 44 24 08          	mov    %eax,0x8(%esp)
c010ad9c:	c7 44 24 04 08 fc 13 	movl   $0xc013fc08,0x4(%esp)
c010ada3:	c0 
c010ada4:	c7 04 24 5e e4 10 c0 	movl   $0xc010e45e,(%esp)
c010adab:	e8 7b ff ff ff       	call   c010ad2b <kernel_execve>
#else
    KERNEL_EXECVE(exit);
#endif
    panic("user_main execve failed.\n");
c010adb0:	c7 44 24 08 8f e4 10 	movl   $0xc010e48f,0x8(%esp)
c010adb7:	c0 
c010adb8:	c7 44 24 04 15 03 00 	movl   $0x315,0x4(%esp)
c010adbf:	00 
c010adc0:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010adc7:	e8 71 56 ff ff       	call   c010043d <__panic>

c010adcc <init_main>:
}

// init_main - the second kernel thread used to create user_main kernel threads
static int
init_main(void *arg) {
c010adcc:	f3 0f 1e fb          	endbr32 
c010add0:	55                   	push   %ebp
c010add1:	89 e5                	mov    %esp,%ebp
c010add3:	83 ec 38             	sub    $0x38,%esp
    size_t nr_free_pages_store = nr_free_pages();
c010add6:	e8 40 8c ff ff       	call   c0103a1b <nr_free_pages>
c010addb:	89 45 f4             	mov    %eax,-0xc(%ebp)
    size_t kernel_allocated_store = kallocated();
c010adde:	e8 fb c3 ff ff       	call   c01071de <kallocated>
c010ade3:	89 45 f0             	mov    %eax,-0x10(%ebp)

    int pid = kernel_thread(user_main, NULL, 0);
c010ade6:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010aded:	00 
c010adee:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010adf5:	00 
c010adf6:	c7 04 24 69 ad 10 c0 	movl   $0xc010ad69,(%esp)
c010adfd:	e8 a7 ee ff ff       	call   c0109ca9 <kernel_thread>
c010ae02:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if (pid <= 0) {
c010ae05:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010ae09:	7f 21                	jg     c010ae2c <init_main+0x60>
        panic("create user_main failed.\n");
c010ae0b:	c7 44 24 08 a9 e4 10 	movl   $0xc010e4a9,0x8(%esp)
c010ae12:	c0 
c010ae13:	c7 44 24 04 20 03 00 	movl   $0x320,0x4(%esp)
c010ae1a:	00 
c010ae1b:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010ae22:	e8 16 56 ff ff       	call   c010043d <__panic>
    }

    while (do_wait(0, NULL) == 0) {
        schedule();
c010ae27:	e8 cf 03 00 00       	call   c010b1fb <schedule>
    while (do_wait(0, NULL) == 0) {
c010ae2c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010ae33:	00 
c010ae34:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c010ae3b:	e8 f1 fc ff ff       	call   c010ab31 <do_wait>
c010ae40:	85 c0                	test   %eax,%eax
c010ae42:	74 e3                	je     c010ae27 <init_main+0x5b>
    }

    cprintf("all user-mode processes have quit.\n");
c010ae44:	c7 04 24 c4 e4 10 c0 	movl   $0xc010e4c4,(%esp)
c010ae4b:	e8 81 54 ff ff       	call   c01002d1 <cprintf>
    assert(initproc->cptr == NULL && initproc->yptr == NULL && initproc->optr == NULL);
c010ae50:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010ae55:	8b 40 70             	mov    0x70(%eax),%eax
c010ae58:	85 c0                	test   %eax,%eax
c010ae5a:	75 18                	jne    c010ae74 <init_main+0xa8>
c010ae5c:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010ae61:	8b 40 74             	mov    0x74(%eax),%eax
c010ae64:	85 c0                	test   %eax,%eax
c010ae66:	75 0c                	jne    c010ae74 <init_main+0xa8>
c010ae68:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010ae6d:	8b 40 78             	mov    0x78(%eax),%eax
c010ae70:	85 c0                	test   %eax,%eax
c010ae72:	74 24                	je     c010ae98 <init_main+0xcc>
c010ae74:	c7 44 24 0c e8 e4 10 	movl   $0xc010e4e8,0xc(%esp)
c010ae7b:	c0 
c010ae7c:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010ae83:	c0 
c010ae84:	c7 44 24 04 28 03 00 	movl   $0x328,0x4(%esp)
c010ae8b:	00 
c010ae8c:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010ae93:	e8 a5 55 ff ff       	call   c010043d <__panic>
    assert(nr_process == 2);
c010ae98:	a1 40 40 1b c0       	mov    0xc01b4040,%eax
c010ae9d:	83 f8 02             	cmp    $0x2,%eax
c010aea0:	74 24                	je     c010aec6 <init_main+0xfa>
c010aea2:	c7 44 24 0c 33 e5 10 	movl   $0xc010e533,0xc(%esp)
c010aea9:	c0 
c010aeaa:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010aeb1:	c0 
c010aeb2:	c7 44 24 04 29 03 00 	movl   $0x329,0x4(%esp)
c010aeb9:	00 
c010aeba:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010aec1:	e8 77 55 ff ff       	call   c010043d <__panic>
c010aec6:	c7 45 e8 50 41 1b c0 	movl   $0xc01b4150,-0x18(%ebp)
c010aecd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010aed0:	8b 40 04             	mov    0x4(%eax),%eax
    assert(list_next(&proc_list) == &(initproc->list_link));
c010aed3:	8b 15 24 20 1b c0    	mov    0xc01b2024,%edx
c010aed9:	83 c2 58             	add    $0x58,%edx
c010aedc:	39 d0                	cmp    %edx,%eax
c010aede:	74 24                	je     c010af04 <init_main+0x138>
c010aee0:	c7 44 24 0c 44 e5 10 	movl   $0xc010e544,0xc(%esp)
c010aee7:	c0 
c010aee8:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010aeef:	c0 
c010aef0:	c7 44 24 04 2a 03 00 	movl   $0x32a,0x4(%esp)
c010aef7:	00 
c010aef8:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010aeff:	e8 39 55 ff ff       	call   c010043d <__panic>
c010af04:	c7 45 e4 50 41 1b c0 	movl   $0xc01b4150,-0x1c(%ebp)
    return listelm->prev;
c010af0b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010af0e:	8b 00                	mov    (%eax),%eax
    assert(list_prev(&proc_list) == &(initproc->list_link));
c010af10:	8b 15 24 20 1b c0    	mov    0xc01b2024,%edx
c010af16:	83 c2 58             	add    $0x58,%edx
c010af19:	39 d0                	cmp    %edx,%eax
c010af1b:	74 24                	je     c010af41 <init_main+0x175>
c010af1d:	c7 44 24 0c 74 e5 10 	movl   $0xc010e574,0xc(%esp)
c010af24:	c0 
c010af25:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010af2c:	c0 
c010af2d:	c7 44 24 04 2b 03 00 	movl   $0x32b,0x4(%esp)
c010af34:	00 
c010af35:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010af3c:	e8 fc 54 ff ff       	call   c010043d <__panic>

    cprintf("init check memory pass.\n");
c010af41:	c7 04 24 a4 e5 10 c0 	movl   $0xc010e5a4,(%esp)
c010af48:	e8 84 53 ff ff       	call   c01002d1 <cprintf>
    return 0;
c010af4d:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010af52:	c9                   	leave  
c010af53:	c3                   	ret    

c010af54 <proc_init>:

// proc_init - set up the first kernel thread idleproc "idle" by itself and 
//           - create the second kernel thread init_main
void
proc_init(void) {
c010af54:	f3 0f 1e fb          	endbr32 
c010af58:	55                   	push   %ebp
c010af59:	89 e5                	mov    %esp,%ebp
c010af5b:	83 ec 28             	sub    $0x28,%esp
c010af5e:	c7 45 ec 50 41 1b c0 	movl   $0xc01b4150,-0x14(%ebp)
    elm->prev = elm->next = elm;
c010af65:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010af68:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010af6b:	89 50 04             	mov    %edx,0x4(%eax)
c010af6e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010af71:	8b 50 04             	mov    0x4(%eax),%edx
c010af74:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010af77:	89 10                	mov    %edx,(%eax)
}
c010af79:	90                   	nop
    int i;

    list_init(&proc_list);
    for (i = 0; i < HASH_LIST_SIZE; i ++) {
c010af7a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c010af81:	eb 26                	jmp    c010afa9 <proc_init+0x55>
        list_init(hash_list + i);
c010af83:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010af86:	c1 e0 03             	shl    $0x3,%eax
c010af89:	05 40 20 1b c0       	add    $0xc01b2040,%eax
c010af8e:	89 45 e8             	mov    %eax,-0x18(%ebp)
    elm->prev = elm->next = elm;
c010af91:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010af94:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010af97:	89 50 04             	mov    %edx,0x4(%eax)
c010af9a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010af9d:	8b 50 04             	mov    0x4(%eax),%edx
c010afa0:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010afa3:	89 10                	mov    %edx,(%eax)
}
c010afa5:	90                   	nop
    for (i = 0; i < HASH_LIST_SIZE; i ++) {
c010afa6:	ff 45 f4             	incl   -0xc(%ebp)
c010afa9:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
c010afb0:	7e d1                	jle    c010af83 <proc_init+0x2f>
    }

    if ((idleproc = alloc_proc()) == NULL) {
c010afb2:	e8 78 e7 ff ff       	call   c010972f <alloc_proc>
c010afb7:	a3 20 20 1b c0       	mov    %eax,0xc01b2020
c010afbc:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010afc1:	85 c0                	test   %eax,%eax
c010afc3:	75 1c                	jne    c010afe1 <proc_init+0x8d>
        panic("cannot alloc idleproc.\n");
c010afc5:	c7 44 24 08 bd e5 10 	movl   $0xc010e5bd,0x8(%esp)
c010afcc:	c0 
c010afcd:	c7 44 24 04 3d 03 00 	movl   $0x33d,0x4(%esp)
c010afd4:	00 
c010afd5:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010afdc:	e8 5c 54 ff ff       	call   c010043d <__panic>
    }

    idleproc->pid = 0;
c010afe1:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010afe6:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    idleproc->state = PROC_RUNNABLE;
c010afed:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010aff2:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
    idleproc->kstack = (uintptr_t)bootstack;
c010aff8:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010affd:	ba 00 c0 12 c0       	mov    $0xc012c000,%edx
c010b002:	89 50 0c             	mov    %edx,0xc(%eax)
    idleproc->need_resched = 1;
c010b005:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010b00a:	c7 40 10 01 00 00 00 	movl   $0x1,0x10(%eax)
    set_proc_name(idleproc, "idle");
c010b011:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010b016:	c7 44 24 04 d5 e5 10 	movl   $0xc010e5d5,0x4(%esp)
c010b01d:	c0 
c010b01e:	89 04 24             	mov    %eax,(%esp)
c010b021:	e8 fe e7 ff ff       	call   c0109824 <set_proc_name>
    nr_process ++;
c010b026:	a1 40 40 1b c0       	mov    0xc01b4040,%eax
c010b02b:	40                   	inc    %eax
c010b02c:	a3 40 40 1b c0       	mov    %eax,0xc01b4040

    current = idleproc;
c010b031:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010b036:	a3 28 20 1b c0       	mov    %eax,0xc01b2028

    int pid = kernel_thread(init_main, NULL, 0);
c010b03b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010b042:	00 
c010b043:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010b04a:	00 
c010b04b:	c7 04 24 cc ad 10 c0 	movl   $0xc010adcc,(%esp)
c010b052:	e8 52 ec ff ff       	call   c0109ca9 <kernel_thread>
c010b057:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (pid <= 0) {
c010b05a:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010b05e:	7f 1c                	jg     c010b07c <proc_init+0x128>
        panic("create init_main failed.\n");
c010b060:	c7 44 24 08 da e5 10 	movl   $0xc010e5da,0x8(%esp)
c010b067:	c0 
c010b068:	c7 44 24 04 4b 03 00 	movl   $0x34b,0x4(%esp)
c010b06f:	00 
c010b070:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010b077:	e8 c1 53 ff ff       	call   c010043d <__panic>
    }

    initproc = find_proc(pid);
c010b07c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b07f:	89 04 24             	mov    %eax,(%esp)
c010b082:	e8 ac eb ff ff       	call   c0109c33 <find_proc>
c010b087:	a3 24 20 1b c0       	mov    %eax,0xc01b2024
    set_proc_name(initproc, "init");
c010b08c:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010b091:	c7 44 24 04 f4 e5 10 	movl   $0xc010e5f4,0x4(%esp)
c010b098:	c0 
c010b099:	89 04 24             	mov    %eax,(%esp)
c010b09c:	e8 83 e7 ff ff       	call   c0109824 <set_proc_name>

    assert(idleproc != NULL && idleproc->pid == 0);
c010b0a1:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010b0a6:	85 c0                	test   %eax,%eax
c010b0a8:	74 0c                	je     c010b0b6 <proc_init+0x162>
c010b0aa:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010b0af:	8b 40 04             	mov    0x4(%eax),%eax
c010b0b2:	85 c0                	test   %eax,%eax
c010b0b4:	74 24                	je     c010b0da <proc_init+0x186>
c010b0b6:	c7 44 24 0c fc e5 10 	movl   $0xc010e5fc,0xc(%esp)
c010b0bd:	c0 
c010b0be:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010b0c5:	c0 
c010b0c6:	c7 44 24 04 51 03 00 	movl   $0x351,0x4(%esp)
c010b0cd:	00 
c010b0ce:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010b0d5:	e8 63 53 ff ff       	call   c010043d <__panic>
    assert(initproc != NULL && initproc->pid == 1);
c010b0da:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010b0df:	85 c0                	test   %eax,%eax
c010b0e1:	74 0d                	je     c010b0f0 <proc_init+0x19c>
c010b0e3:	a1 24 20 1b c0       	mov    0xc01b2024,%eax
c010b0e8:	8b 40 04             	mov    0x4(%eax),%eax
c010b0eb:	83 f8 01             	cmp    $0x1,%eax
c010b0ee:	74 24                	je     c010b114 <proc_init+0x1c0>
c010b0f0:	c7 44 24 0c 24 e6 10 	movl   $0xc010e624,0xc(%esp)
c010b0f7:	c0 
c010b0f8:	c7 44 24 08 67 e2 10 	movl   $0xc010e267,0x8(%esp)
c010b0ff:	c0 
c010b100:	c7 44 24 04 52 03 00 	movl   $0x352,0x4(%esp)
c010b107:	00 
c010b108:	c7 04 24 3c e2 10 c0 	movl   $0xc010e23c,(%esp)
c010b10f:	e8 29 53 ff ff       	call   c010043d <__panic>
}
c010b114:	90                   	nop
c010b115:	c9                   	leave  
c010b116:	c3                   	ret    

c010b117 <cpu_idle>:

// cpu_idle - at the end of kern_init, the first kernel thread idleproc will do below works
void
cpu_idle(void) {
c010b117:	f3 0f 1e fb          	endbr32 
c010b11b:	55                   	push   %ebp
c010b11c:	89 e5                	mov    %esp,%ebp
c010b11e:	83 ec 08             	sub    $0x8,%esp
    while (1) {
        if (current->need_resched) {
c010b121:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b126:	8b 40 10             	mov    0x10(%eax),%eax
c010b129:	85 c0                	test   %eax,%eax
c010b12b:	74 f4                	je     c010b121 <cpu_idle+0xa>
            schedule();
c010b12d:	e8 c9 00 00 00       	call   c010b1fb <schedule>
        if (current->need_resched) {
c010b132:	eb ed                	jmp    c010b121 <cpu_idle+0xa>

c010b134 <__intr_save>:
__intr_save(void) {
c010b134:	55                   	push   %ebp
c010b135:	89 e5                	mov    %esp,%ebp
c010b137:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c010b13a:	9c                   	pushf  
c010b13b:	58                   	pop    %eax
c010b13c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c010b13f:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c010b142:	25 00 02 00 00       	and    $0x200,%eax
c010b147:	85 c0                	test   %eax,%eax
c010b149:	74 0c                	je     c010b157 <__intr_save+0x23>
        intr_disable();
c010b14b:	e8 a8 71 ff ff       	call   c01022f8 <intr_disable>
        return 1;
c010b150:	b8 01 00 00 00       	mov    $0x1,%eax
c010b155:	eb 05                	jmp    c010b15c <__intr_save+0x28>
    return 0;
c010b157:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010b15c:	c9                   	leave  
c010b15d:	c3                   	ret    

c010b15e <__intr_restore>:
__intr_restore(bool flag) {
c010b15e:	55                   	push   %ebp
c010b15f:	89 e5                	mov    %esp,%ebp
c010b161:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c010b164:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010b168:	74 05                	je     c010b16f <__intr_restore+0x11>
        intr_enable();
c010b16a:	e8 7d 71 ff ff       	call   c01022ec <intr_enable>
}
c010b16f:	90                   	nop
c010b170:	c9                   	leave  
c010b171:	c3                   	ret    

c010b172 <wakeup_proc>:
#include <proc.h>
#include <sched.h>
#include <assert.h>

void
wakeup_proc(struct proc_struct *proc) {
c010b172:	f3 0f 1e fb          	endbr32 
c010b176:	55                   	push   %ebp
c010b177:	89 e5                	mov    %esp,%ebp
c010b179:	83 ec 28             	sub    $0x28,%esp
    assert(proc->state != PROC_ZOMBIE);
c010b17c:	8b 45 08             	mov    0x8(%ebp),%eax
c010b17f:	8b 00                	mov    (%eax),%eax
c010b181:	83 f8 03             	cmp    $0x3,%eax
c010b184:	75 24                	jne    c010b1aa <wakeup_proc+0x38>
c010b186:	c7 44 24 0c 4b e6 10 	movl   $0xc010e64b,0xc(%esp)
c010b18d:	c0 
c010b18e:	c7 44 24 08 66 e6 10 	movl   $0xc010e666,0x8(%esp)
c010b195:	c0 
c010b196:	c7 44 24 04 09 00 00 	movl   $0x9,0x4(%esp)
c010b19d:	00 
c010b19e:	c7 04 24 7b e6 10 c0 	movl   $0xc010e67b,(%esp)
c010b1a5:	e8 93 52 ff ff       	call   c010043d <__panic>
    bool intr_flag;
    local_intr_save(intr_flag);
c010b1aa:	e8 85 ff ff ff       	call   c010b134 <__intr_save>
c010b1af:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        if (proc->state != PROC_RUNNABLE) {
c010b1b2:	8b 45 08             	mov    0x8(%ebp),%eax
c010b1b5:	8b 00                	mov    (%eax),%eax
c010b1b7:	83 f8 02             	cmp    $0x2,%eax
c010b1ba:	74 15                	je     c010b1d1 <wakeup_proc+0x5f>
            proc->state = PROC_RUNNABLE;
c010b1bc:	8b 45 08             	mov    0x8(%ebp),%eax
c010b1bf:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
            proc->wait_state = 0;
c010b1c5:	8b 45 08             	mov    0x8(%ebp),%eax
c010b1c8:	c7 40 6c 00 00 00 00 	movl   $0x0,0x6c(%eax)
c010b1cf:	eb 1c                	jmp    c010b1ed <wakeup_proc+0x7b>
        }
        else {
            warn("wakeup runnable process.\n");
c010b1d1:	c7 44 24 08 91 e6 10 	movl   $0xc010e691,0x8(%esp)
c010b1d8:	c0 
c010b1d9:	c7 44 24 04 12 00 00 	movl   $0x12,0x4(%esp)
c010b1e0:	00 
c010b1e1:	c7 04 24 7b e6 10 c0 	movl   $0xc010e67b,(%esp)
c010b1e8:	e8 d2 52 ff ff       	call   c01004bf <__warn>
        }
    }
    local_intr_restore(intr_flag);
c010b1ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b1f0:	89 04 24             	mov    %eax,(%esp)
c010b1f3:	e8 66 ff ff ff       	call   c010b15e <__intr_restore>
}
c010b1f8:	90                   	nop
c010b1f9:	c9                   	leave  
c010b1fa:	c3                   	ret    

c010b1fb <schedule>:

void
schedule(void) {
c010b1fb:	f3 0f 1e fb          	endbr32 
c010b1ff:	55                   	push   %ebp
c010b200:	89 e5                	mov    %esp,%ebp
c010b202:	83 ec 38             	sub    $0x38,%esp
    bool intr_flag;
    list_entry_t *le, *last;
    struct proc_struct *next = NULL;
c010b205:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    local_intr_save(intr_flag);
c010b20c:	e8 23 ff ff ff       	call   c010b134 <__intr_save>
c010b211:	89 45 ec             	mov    %eax,-0x14(%ebp)
    {
        current->need_resched = 0;
c010b214:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b219:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        last = (current == idleproc) ? &proc_list : &(current->list_link);
c010b220:	8b 15 28 20 1b c0    	mov    0xc01b2028,%edx
c010b226:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010b22b:	39 c2                	cmp    %eax,%edx
c010b22d:	74 0a                	je     c010b239 <schedule+0x3e>
c010b22f:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b234:	83 c0 58             	add    $0x58,%eax
c010b237:	eb 05                	jmp    c010b23e <schedule+0x43>
c010b239:	b8 50 41 1b c0       	mov    $0xc01b4150,%eax
c010b23e:	89 45 e8             	mov    %eax,-0x18(%ebp)
        le = last;
c010b241:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010b244:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b247:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b24a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return listelm->next;
c010b24d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010b250:	8b 40 04             	mov    0x4(%eax),%eax
        do {
            if ((le = list_next(le)) != &proc_list) {
c010b253:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b256:	81 7d f4 50 41 1b c0 	cmpl   $0xc01b4150,-0xc(%ebp)
c010b25d:	74 13                	je     c010b272 <schedule+0x77>
                next = le2proc(le, list_link);
c010b25f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b262:	83 e8 58             	sub    $0x58,%eax
c010b265:	89 45 f0             	mov    %eax,-0x10(%ebp)
                if (next->state == PROC_RUNNABLE) {
c010b268:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b26b:	8b 00                	mov    (%eax),%eax
c010b26d:	83 f8 02             	cmp    $0x2,%eax
c010b270:	74 0a                	je     c010b27c <schedule+0x81>
                    break;
                }
            }
        } while (le != last);
c010b272:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b275:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c010b278:	75 cd                	jne    c010b247 <schedule+0x4c>
c010b27a:	eb 01                	jmp    c010b27d <schedule+0x82>
                    break;
c010b27c:	90                   	nop
        if (next == NULL || next->state != PROC_RUNNABLE) {
c010b27d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010b281:	74 0a                	je     c010b28d <schedule+0x92>
c010b283:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b286:	8b 00                	mov    (%eax),%eax
c010b288:	83 f8 02             	cmp    $0x2,%eax
c010b28b:	74 08                	je     c010b295 <schedule+0x9a>
            next = idleproc;
c010b28d:	a1 20 20 1b c0       	mov    0xc01b2020,%eax
c010b292:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        next->runs ++;
c010b295:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b298:	8b 40 08             	mov    0x8(%eax),%eax
c010b29b:	8d 50 01             	lea    0x1(%eax),%edx
c010b29e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b2a1:	89 50 08             	mov    %edx,0x8(%eax)
        if (next != current) {
c010b2a4:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b2a9:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c010b2ac:	74 0b                	je     c010b2b9 <schedule+0xbe>
            proc_run(next);
c010b2ae:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b2b1:	89 04 24             	mov    %eax,(%esp)
c010b2b4:	e8 24 e8 ff ff       	call   c0109add <proc_run>
        }
    }
    local_intr_restore(intr_flag);
c010b2b9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010b2bc:	89 04 24             	mov    %eax,(%esp)
c010b2bf:	e8 9a fe ff ff       	call   c010b15e <__intr_restore>
}
c010b2c4:	90                   	nop
c010b2c5:	c9                   	leave  
c010b2c6:	c3                   	ret    

c010b2c7 <sys_exit>:
#include <stdio.h>
#include <pmm.h>
#include <assert.h>

static int
sys_exit(uint32_t arg[]) {
c010b2c7:	f3 0f 1e fb          	endbr32 
c010b2cb:	55                   	push   %ebp
c010b2cc:	89 e5                	mov    %esp,%ebp
c010b2ce:	83 ec 28             	sub    $0x28,%esp
    int error_code = (int)arg[0];
c010b2d1:	8b 45 08             	mov    0x8(%ebp),%eax
c010b2d4:	8b 00                	mov    (%eax),%eax
c010b2d6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return do_exit(error_code);
c010b2d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b2dc:	89 04 24             	mov    %eax,(%esp)
c010b2df:	e8 bc ee ff ff       	call   c010a1a0 <do_exit>
}
c010b2e4:	c9                   	leave  
c010b2e5:	c3                   	ret    

c010b2e6 <sys_fork>:

static int
sys_fork(uint32_t arg[]) {
c010b2e6:	f3 0f 1e fb          	endbr32 
c010b2ea:	55                   	push   %ebp
c010b2eb:	89 e5                	mov    %esp,%ebp
c010b2ed:	83 ec 28             	sub    $0x28,%esp
    struct trapframe *tf = current->tf;
c010b2f0:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b2f5:	8b 40 3c             	mov    0x3c(%eax),%eax
c010b2f8:	89 45 f4             	mov    %eax,-0xc(%ebp)
    uintptr_t stack = tf->tf_esp;
c010b2fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b2fe:	8b 40 44             	mov    0x44(%eax),%eax
c010b301:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return do_fork(0, stack, tf);
c010b304:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b307:	89 44 24 08          	mov    %eax,0x8(%esp)
c010b30b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b30e:	89 44 24 04          	mov    %eax,0x4(%esp)
c010b312:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c010b319:	e8 55 ed ff ff       	call   c010a073 <do_fork>
}
c010b31e:	c9                   	leave  
c010b31f:	c3                   	ret    

c010b320 <sys_wait>:

static int
sys_wait(uint32_t arg[]) {
c010b320:	f3 0f 1e fb          	endbr32 
c010b324:	55                   	push   %ebp
c010b325:	89 e5                	mov    %esp,%ebp
c010b327:	83 ec 28             	sub    $0x28,%esp
    int pid = (int)arg[0];
c010b32a:	8b 45 08             	mov    0x8(%ebp),%eax
c010b32d:	8b 00                	mov    (%eax),%eax
c010b32f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    int *store = (int *)arg[1];
c010b332:	8b 45 08             	mov    0x8(%ebp),%eax
c010b335:	83 c0 04             	add    $0x4,%eax
c010b338:	8b 00                	mov    (%eax),%eax
c010b33a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return do_wait(pid, store);
c010b33d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b340:	89 44 24 04          	mov    %eax,0x4(%esp)
c010b344:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b347:	89 04 24             	mov    %eax,(%esp)
c010b34a:	e8 e2 f7 ff ff       	call   c010ab31 <do_wait>
}
c010b34f:	c9                   	leave  
c010b350:	c3                   	ret    

c010b351 <sys_exec>:

static int
sys_exec(uint32_t arg[]) {
c010b351:	f3 0f 1e fb          	endbr32 
c010b355:	55                   	push   %ebp
c010b356:	89 e5                	mov    %esp,%ebp
c010b358:	83 ec 28             	sub    $0x28,%esp
    const char *name = (const char *)arg[0];
c010b35b:	8b 45 08             	mov    0x8(%ebp),%eax
c010b35e:	8b 00                	mov    (%eax),%eax
c010b360:	89 45 f4             	mov    %eax,-0xc(%ebp)
    size_t len = (size_t)arg[1];
c010b363:	8b 45 08             	mov    0x8(%ebp),%eax
c010b366:	83 c0 04             	add    $0x4,%eax
c010b369:	8b 00                	mov    (%eax),%eax
c010b36b:	89 45 f0             	mov    %eax,-0x10(%ebp)
    unsigned char *binary = (unsigned char *)arg[2];
c010b36e:	8b 45 08             	mov    0x8(%ebp),%eax
c010b371:	83 c0 08             	add    $0x8,%eax
c010b374:	8b 00                	mov    (%eax),%eax
c010b376:	89 45 ec             	mov    %eax,-0x14(%ebp)
    size_t size = (size_t)arg[3];
c010b379:	8b 45 08             	mov    0x8(%ebp),%eax
c010b37c:	83 c0 0c             	add    $0xc,%eax
c010b37f:	8b 00                	mov    (%eax),%eax
c010b381:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return do_execve(name, len, binary, size);
c010b384:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010b387:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010b38b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010b38e:	89 44 24 08          	mov    %eax,0x8(%esp)
c010b392:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b395:	89 44 24 04          	mov    %eax,0x4(%esp)
c010b399:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b39c:	89 04 24             	mov    %eax,(%esp)
c010b39f:	e8 32 f6 ff ff       	call   c010a9d6 <do_execve>
}
c010b3a4:	c9                   	leave  
c010b3a5:	c3                   	ret    

c010b3a6 <sys_yield>:

static int
sys_yield(uint32_t arg[]) {
c010b3a6:	f3 0f 1e fb          	endbr32 
c010b3aa:	55                   	push   %ebp
c010b3ab:	89 e5                	mov    %esp,%ebp
c010b3ad:	83 ec 08             	sub    $0x8,%esp
    return do_yield();
c010b3b0:	e8 62 f7 ff ff       	call   c010ab17 <do_yield>
}
c010b3b5:	c9                   	leave  
c010b3b6:	c3                   	ret    

c010b3b7 <sys_kill>:

static int
sys_kill(uint32_t arg[]) {
c010b3b7:	f3 0f 1e fb          	endbr32 
c010b3bb:	55                   	push   %ebp
c010b3bc:	89 e5                	mov    %esp,%ebp
c010b3be:	83 ec 28             	sub    $0x28,%esp
    int pid = (int)arg[0];
c010b3c1:	8b 45 08             	mov    0x8(%ebp),%eax
c010b3c4:	8b 00                	mov    (%eax),%eax
c010b3c6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return do_kill(pid);
c010b3c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b3cc:	89 04 24             	mov    %eax,(%esp)
c010b3cf:	e8 f1 f8 ff ff       	call   c010acc5 <do_kill>
}
c010b3d4:	c9                   	leave  
c010b3d5:	c3                   	ret    

c010b3d6 <sys_getpid>:

static int
sys_getpid(uint32_t arg[]) {
c010b3d6:	f3 0f 1e fb          	endbr32 
c010b3da:	55                   	push   %ebp
c010b3db:	89 e5                	mov    %esp,%ebp
    return current->pid;
c010b3dd:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b3e2:	8b 40 04             	mov    0x4(%eax),%eax
}
c010b3e5:	5d                   	pop    %ebp
c010b3e6:	c3                   	ret    

c010b3e7 <sys_putc>:

static int
sys_putc(uint32_t arg[]) {
c010b3e7:	f3 0f 1e fb          	endbr32 
c010b3eb:	55                   	push   %ebp
c010b3ec:	89 e5                	mov    %esp,%ebp
c010b3ee:	83 ec 28             	sub    $0x28,%esp
    int c = (int)arg[0];
c010b3f1:	8b 45 08             	mov    0x8(%ebp),%eax
c010b3f4:	8b 00                	mov    (%eax),%eax
c010b3f6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cputchar(c);
c010b3f9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b3fc:	89 04 24             	mov    %eax,(%esp)
c010b3ff:	e8 f7 4e ff ff       	call   c01002fb <cputchar>
    return 0;
c010b404:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010b409:	c9                   	leave  
c010b40a:	c3                   	ret    

c010b40b <sys_pgdir>:

static int
sys_pgdir(uint32_t arg[]) {
c010b40b:	f3 0f 1e fb          	endbr32 
c010b40f:	55                   	push   %ebp
c010b410:	89 e5                	mov    %esp,%ebp
c010b412:	83 ec 08             	sub    $0x8,%esp
    print_pgdir();
c010b415:	e8 df 9f ff ff       	call   c01053f9 <print_pgdir>
    return 0;
c010b41a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010b41f:	c9                   	leave  
c010b420:	c3                   	ret    

c010b421 <syscall>:
};

#define NUM_SYSCALLS        ((sizeof(syscalls)) / (sizeof(syscalls[0])))

void
syscall(void) {
c010b421:	f3 0f 1e fb          	endbr32 
c010b425:	55                   	push   %ebp
c010b426:	89 e5                	mov    %esp,%ebp
c010b428:	83 ec 48             	sub    $0x48,%esp
    struct trapframe *tf = current->tf;
c010b42b:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b430:	8b 40 3c             	mov    0x3c(%eax),%eax
c010b433:	89 45 f4             	mov    %eax,-0xc(%ebp)
    uint32_t arg[5];
    int num = tf->tf_regs.reg_eax;
c010b436:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b439:	8b 40 1c             	mov    0x1c(%eax),%eax
c010b43c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (num >= 0 && num < NUM_SYSCALLS) {
c010b43f:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010b443:	78 5e                	js     c010b4a3 <syscall+0x82>
c010b445:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b448:	83 f8 1f             	cmp    $0x1f,%eax
c010b44b:	77 56                	ja     c010b4a3 <syscall+0x82>
        if (syscalls[num] != NULL) {
c010b44d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b450:	8b 04 85 80 ea 12 c0 	mov    -0x3fed1580(,%eax,4),%eax
c010b457:	85 c0                	test   %eax,%eax
c010b459:	74 48                	je     c010b4a3 <syscall+0x82>
            arg[0] = tf->tf_regs.reg_edx;
c010b45b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b45e:	8b 40 14             	mov    0x14(%eax),%eax
c010b461:	89 45 dc             	mov    %eax,-0x24(%ebp)
            arg[1] = tf->tf_regs.reg_ecx;
c010b464:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b467:	8b 40 18             	mov    0x18(%eax),%eax
c010b46a:	89 45 e0             	mov    %eax,-0x20(%ebp)
            arg[2] = tf->tf_regs.reg_ebx;
c010b46d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b470:	8b 40 10             	mov    0x10(%eax),%eax
c010b473:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            arg[3] = tf->tf_regs.reg_edi;
c010b476:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b479:	8b 00                	mov    (%eax),%eax
c010b47b:	89 45 e8             	mov    %eax,-0x18(%ebp)
            arg[4] = tf->tf_regs.reg_esi;
c010b47e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b481:	8b 40 04             	mov    0x4(%eax),%eax
c010b484:	89 45 ec             	mov    %eax,-0x14(%ebp)
            tf->tf_regs.reg_eax = syscalls[num](arg);
c010b487:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b48a:	8b 04 85 80 ea 12 c0 	mov    -0x3fed1580(,%eax,4),%eax
c010b491:	8d 55 dc             	lea    -0x24(%ebp),%edx
c010b494:	89 14 24             	mov    %edx,(%esp)
c010b497:	ff d0                	call   *%eax
c010b499:	89 c2                	mov    %eax,%edx
c010b49b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b49e:	89 50 1c             	mov    %edx,0x1c(%eax)
            return ;
c010b4a1:	eb 46                	jmp    c010b4e9 <syscall+0xc8>
        }
    }
    print_trapframe(tf);
c010b4a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b4a6:	89 04 24             	mov    %eax,(%esp)
c010b4a9:	e8 5f 70 ff ff       	call   c010250d <print_trapframe>
    panic("undefined syscall %d, pid = %d, name = %s.\n",
c010b4ae:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b4b3:	8d 50 48             	lea    0x48(%eax),%edx
c010b4b6:	a1 28 20 1b c0       	mov    0xc01b2028,%eax
c010b4bb:	8b 40 04             	mov    0x4(%eax),%eax
c010b4be:	89 54 24 14          	mov    %edx,0x14(%esp)
c010b4c2:	89 44 24 10          	mov    %eax,0x10(%esp)
c010b4c6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b4c9:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010b4cd:	c7 44 24 08 ac e6 10 	movl   $0xc010e6ac,0x8(%esp)
c010b4d4:	c0 
c010b4d5:	c7 44 24 04 62 00 00 	movl   $0x62,0x4(%esp)
c010b4dc:	00 
c010b4dd:	c7 04 24 d8 e6 10 c0 	movl   $0xc010e6d8,(%esp)
c010b4e4:	e8 54 4f ff ff       	call   c010043d <__panic>
            num, current->pid, current->name);
}
c010b4e9:	c9                   	leave  
c010b4ea:	c3                   	ret    

c010b4eb <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
c010b4eb:	f3 0f 1e fb          	endbr32 
c010b4ef:	55                   	push   %ebp
c010b4f0:	89 e5                	mov    %esp,%ebp
c010b4f2:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c010b4f5:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
c010b4fc:	eb 03                	jmp    c010b501 <strlen+0x16>
        cnt ++;
c010b4fe:	ff 45 fc             	incl   -0x4(%ebp)
    while (*s ++ != '\0') {
c010b501:	8b 45 08             	mov    0x8(%ebp),%eax
c010b504:	8d 50 01             	lea    0x1(%eax),%edx
c010b507:	89 55 08             	mov    %edx,0x8(%ebp)
c010b50a:	0f b6 00             	movzbl (%eax),%eax
c010b50d:	84 c0                	test   %al,%al
c010b50f:	75 ed                	jne    c010b4fe <strlen+0x13>
    }
    return cnt;
c010b511:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c010b514:	c9                   	leave  
c010b515:	c3                   	ret    

c010b516 <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
c010b516:	f3 0f 1e fb          	endbr32 
c010b51a:	55                   	push   %ebp
c010b51b:	89 e5                	mov    %esp,%ebp
c010b51d:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c010b520:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c010b527:	eb 03                	jmp    c010b52c <strnlen+0x16>
        cnt ++;
c010b529:	ff 45 fc             	incl   -0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c010b52c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010b52f:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010b532:	73 10                	jae    c010b544 <strnlen+0x2e>
c010b534:	8b 45 08             	mov    0x8(%ebp),%eax
c010b537:	8d 50 01             	lea    0x1(%eax),%edx
c010b53a:	89 55 08             	mov    %edx,0x8(%ebp)
c010b53d:	0f b6 00             	movzbl (%eax),%eax
c010b540:	84 c0                	test   %al,%al
c010b542:	75 e5                	jne    c010b529 <strnlen+0x13>
    }
    return cnt;
c010b544:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c010b547:	c9                   	leave  
c010b548:	c3                   	ret    

c010b549 <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
c010b549:	f3 0f 1e fb          	endbr32 
c010b54d:	55                   	push   %ebp
c010b54e:	89 e5                	mov    %esp,%ebp
c010b550:	57                   	push   %edi
c010b551:	56                   	push   %esi
c010b552:	83 ec 20             	sub    $0x20,%esp
c010b555:	8b 45 08             	mov    0x8(%ebp),%eax
c010b558:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b55b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b55e:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
c010b561:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010b564:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b567:	89 d1                	mov    %edx,%ecx
c010b569:	89 c2                	mov    %eax,%edx
c010b56b:	89 ce                	mov    %ecx,%esi
c010b56d:	89 d7                	mov    %edx,%edi
c010b56f:	ac                   	lods   %ds:(%esi),%al
c010b570:	aa                   	stos   %al,%es:(%edi)
c010b571:	84 c0                	test   %al,%al
c010b573:	75 fa                	jne    c010b56f <strcpy+0x26>
c010b575:	89 fa                	mov    %edi,%edx
c010b577:	89 f1                	mov    %esi,%ecx
c010b579:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c010b57c:	89 55 e8             	mov    %edx,-0x18(%ebp)
c010b57f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
c010b582:	8b 45 f4             	mov    -0xc(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
c010b585:	83 c4 20             	add    $0x20,%esp
c010b588:	5e                   	pop    %esi
c010b589:	5f                   	pop    %edi
c010b58a:	5d                   	pop    %ebp
c010b58b:	c3                   	ret    

c010b58c <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
c010b58c:	f3 0f 1e fb          	endbr32 
c010b590:	55                   	push   %ebp
c010b591:	89 e5                	mov    %esp,%ebp
c010b593:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
c010b596:	8b 45 08             	mov    0x8(%ebp),%eax
c010b599:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
c010b59c:	eb 1e                	jmp    c010b5bc <strncpy+0x30>
        if ((*p = *src) != '\0') {
c010b59e:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b5a1:	0f b6 10             	movzbl (%eax),%edx
c010b5a4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010b5a7:	88 10                	mov    %dl,(%eax)
c010b5a9:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010b5ac:	0f b6 00             	movzbl (%eax),%eax
c010b5af:	84 c0                	test   %al,%al
c010b5b1:	74 03                	je     c010b5b6 <strncpy+0x2a>
            src ++;
c010b5b3:	ff 45 0c             	incl   0xc(%ebp)
        }
        p ++, len --;
c010b5b6:	ff 45 fc             	incl   -0x4(%ebp)
c010b5b9:	ff 4d 10             	decl   0x10(%ebp)
    while (len > 0) {
c010b5bc:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010b5c0:	75 dc                	jne    c010b59e <strncpy+0x12>
    }
    return dst;
c010b5c2:	8b 45 08             	mov    0x8(%ebp),%eax
}
c010b5c5:	c9                   	leave  
c010b5c6:	c3                   	ret    

c010b5c7 <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
c010b5c7:	f3 0f 1e fb          	endbr32 
c010b5cb:	55                   	push   %ebp
c010b5cc:	89 e5                	mov    %esp,%ebp
c010b5ce:	57                   	push   %edi
c010b5cf:	56                   	push   %esi
c010b5d0:	83 ec 20             	sub    $0x20,%esp
c010b5d3:	8b 45 08             	mov    0x8(%ebp),%eax
c010b5d6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b5d9:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b5dc:	89 45 f0             	mov    %eax,-0x10(%ebp)
    asm volatile (
c010b5df:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010b5e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b5e5:	89 d1                	mov    %edx,%ecx
c010b5e7:	89 c2                	mov    %eax,%edx
c010b5e9:	89 ce                	mov    %ecx,%esi
c010b5eb:	89 d7                	mov    %edx,%edi
c010b5ed:	ac                   	lods   %ds:(%esi),%al
c010b5ee:	ae                   	scas   %es:(%edi),%al
c010b5ef:	75 08                	jne    c010b5f9 <strcmp+0x32>
c010b5f1:	84 c0                	test   %al,%al
c010b5f3:	75 f8                	jne    c010b5ed <strcmp+0x26>
c010b5f5:	31 c0                	xor    %eax,%eax
c010b5f7:	eb 04                	jmp    c010b5fd <strcmp+0x36>
c010b5f9:	19 c0                	sbb    %eax,%eax
c010b5fb:	0c 01                	or     $0x1,%al
c010b5fd:	89 fa                	mov    %edi,%edx
c010b5ff:	89 f1                	mov    %esi,%ecx
c010b601:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010b604:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c010b607:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return ret;
c010b60a:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
c010b60d:	83 c4 20             	add    $0x20,%esp
c010b610:	5e                   	pop    %esi
c010b611:	5f                   	pop    %edi
c010b612:	5d                   	pop    %ebp
c010b613:	c3                   	ret    

c010b614 <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
c010b614:	f3 0f 1e fb          	endbr32 
c010b618:	55                   	push   %ebp
c010b619:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c010b61b:	eb 09                	jmp    c010b626 <strncmp+0x12>
        n --, s1 ++, s2 ++;
c010b61d:	ff 4d 10             	decl   0x10(%ebp)
c010b620:	ff 45 08             	incl   0x8(%ebp)
c010b623:	ff 45 0c             	incl   0xc(%ebp)
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c010b626:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010b62a:	74 1a                	je     c010b646 <strncmp+0x32>
c010b62c:	8b 45 08             	mov    0x8(%ebp),%eax
c010b62f:	0f b6 00             	movzbl (%eax),%eax
c010b632:	84 c0                	test   %al,%al
c010b634:	74 10                	je     c010b646 <strncmp+0x32>
c010b636:	8b 45 08             	mov    0x8(%ebp),%eax
c010b639:	0f b6 10             	movzbl (%eax),%edx
c010b63c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b63f:	0f b6 00             	movzbl (%eax),%eax
c010b642:	38 c2                	cmp    %al,%dl
c010b644:	74 d7                	je     c010b61d <strncmp+0x9>
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
c010b646:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010b64a:	74 18                	je     c010b664 <strncmp+0x50>
c010b64c:	8b 45 08             	mov    0x8(%ebp),%eax
c010b64f:	0f b6 00             	movzbl (%eax),%eax
c010b652:	0f b6 d0             	movzbl %al,%edx
c010b655:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b658:	0f b6 00             	movzbl (%eax),%eax
c010b65b:	0f b6 c0             	movzbl %al,%eax
c010b65e:	29 c2                	sub    %eax,%edx
c010b660:	89 d0                	mov    %edx,%eax
c010b662:	eb 05                	jmp    c010b669 <strncmp+0x55>
c010b664:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010b669:	5d                   	pop    %ebp
c010b66a:	c3                   	ret    

c010b66b <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
c010b66b:	f3 0f 1e fb          	endbr32 
c010b66f:	55                   	push   %ebp
c010b670:	89 e5                	mov    %esp,%ebp
c010b672:	83 ec 04             	sub    $0x4,%esp
c010b675:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b678:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c010b67b:	eb 13                	jmp    c010b690 <strchr+0x25>
        if (*s == c) {
c010b67d:	8b 45 08             	mov    0x8(%ebp),%eax
c010b680:	0f b6 00             	movzbl (%eax),%eax
c010b683:	38 45 fc             	cmp    %al,-0x4(%ebp)
c010b686:	75 05                	jne    c010b68d <strchr+0x22>
            return (char *)s;
c010b688:	8b 45 08             	mov    0x8(%ebp),%eax
c010b68b:	eb 12                	jmp    c010b69f <strchr+0x34>
        }
        s ++;
c010b68d:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
c010b690:	8b 45 08             	mov    0x8(%ebp),%eax
c010b693:	0f b6 00             	movzbl (%eax),%eax
c010b696:	84 c0                	test   %al,%al
c010b698:	75 e3                	jne    c010b67d <strchr+0x12>
    }
    return NULL;
c010b69a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010b69f:	c9                   	leave  
c010b6a0:	c3                   	ret    

c010b6a1 <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
c010b6a1:	f3 0f 1e fb          	endbr32 
c010b6a5:	55                   	push   %ebp
c010b6a6:	89 e5                	mov    %esp,%ebp
c010b6a8:	83 ec 04             	sub    $0x4,%esp
c010b6ab:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b6ae:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c010b6b1:	eb 0e                	jmp    c010b6c1 <strfind+0x20>
        if (*s == c) {
c010b6b3:	8b 45 08             	mov    0x8(%ebp),%eax
c010b6b6:	0f b6 00             	movzbl (%eax),%eax
c010b6b9:	38 45 fc             	cmp    %al,-0x4(%ebp)
c010b6bc:	74 0f                	je     c010b6cd <strfind+0x2c>
            break;
        }
        s ++;
c010b6be:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
c010b6c1:	8b 45 08             	mov    0x8(%ebp),%eax
c010b6c4:	0f b6 00             	movzbl (%eax),%eax
c010b6c7:	84 c0                	test   %al,%al
c010b6c9:	75 e8                	jne    c010b6b3 <strfind+0x12>
c010b6cb:	eb 01                	jmp    c010b6ce <strfind+0x2d>
            break;
c010b6cd:	90                   	nop
    }
    return (char *)s;
c010b6ce:	8b 45 08             	mov    0x8(%ebp),%eax
}
c010b6d1:	c9                   	leave  
c010b6d2:	c3                   	ret    

c010b6d3 <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
c010b6d3:	f3 0f 1e fb          	endbr32 
c010b6d7:	55                   	push   %ebp
c010b6d8:	89 e5                	mov    %esp,%ebp
c010b6da:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
c010b6dd:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    long val = 0;
c010b6e4:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c010b6eb:	eb 03                	jmp    c010b6f0 <strtol+0x1d>
        s ++;
c010b6ed:	ff 45 08             	incl   0x8(%ebp)
    while (*s == ' ' || *s == '\t') {
c010b6f0:	8b 45 08             	mov    0x8(%ebp),%eax
c010b6f3:	0f b6 00             	movzbl (%eax),%eax
c010b6f6:	3c 20                	cmp    $0x20,%al
c010b6f8:	74 f3                	je     c010b6ed <strtol+0x1a>
c010b6fa:	8b 45 08             	mov    0x8(%ebp),%eax
c010b6fd:	0f b6 00             	movzbl (%eax),%eax
c010b700:	3c 09                	cmp    $0x9,%al
c010b702:	74 e9                	je     c010b6ed <strtol+0x1a>
    }

    // plus/minus sign
    if (*s == '+') {
c010b704:	8b 45 08             	mov    0x8(%ebp),%eax
c010b707:	0f b6 00             	movzbl (%eax),%eax
c010b70a:	3c 2b                	cmp    $0x2b,%al
c010b70c:	75 05                	jne    c010b713 <strtol+0x40>
        s ++;
c010b70e:	ff 45 08             	incl   0x8(%ebp)
c010b711:	eb 14                	jmp    c010b727 <strtol+0x54>
    }
    else if (*s == '-') {
c010b713:	8b 45 08             	mov    0x8(%ebp),%eax
c010b716:	0f b6 00             	movzbl (%eax),%eax
c010b719:	3c 2d                	cmp    $0x2d,%al
c010b71b:	75 0a                	jne    c010b727 <strtol+0x54>
        s ++, neg = 1;
c010b71d:	ff 45 08             	incl   0x8(%ebp)
c010b720:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
c010b727:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010b72b:	74 06                	je     c010b733 <strtol+0x60>
c010b72d:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
c010b731:	75 22                	jne    c010b755 <strtol+0x82>
c010b733:	8b 45 08             	mov    0x8(%ebp),%eax
c010b736:	0f b6 00             	movzbl (%eax),%eax
c010b739:	3c 30                	cmp    $0x30,%al
c010b73b:	75 18                	jne    c010b755 <strtol+0x82>
c010b73d:	8b 45 08             	mov    0x8(%ebp),%eax
c010b740:	40                   	inc    %eax
c010b741:	0f b6 00             	movzbl (%eax),%eax
c010b744:	3c 78                	cmp    $0x78,%al
c010b746:	75 0d                	jne    c010b755 <strtol+0x82>
        s += 2, base = 16;
c010b748:	83 45 08 02          	addl   $0x2,0x8(%ebp)
c010b74c:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
c010b753:	eb 29                	jmp    c010b77e <strtol+0xab>
    }
    else if (base == 0 && s[0] == '0') {
c010b755:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010b759:	75 16                	jne    c010b771 <strtol+0x9e>
c010b75b:	8b 45 08             	mov    0x8(%ebp),%eax
c010b75e:	0f b6 00             	movzbl (%eax),%eax
c010b761:	3c 30                	cmp    $0x30,%al
c010b763:	75 0c                	jne    c010b771 <strtol+0x9e>
        s ++, base = 8;
c010b765:	ff 45 08             	incl   0x8(%ebp)
c010b768:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)
c010b76f:	eb 0d                	jmp    c010b77e <strtol+0xab>
    }
    else if (base == 0) {
c010b771:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010b775:	75 07                	jne    c010b77e <strtol+0xab>
        base = 10;
c010b777:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
c010b77e:	8b 45 08             	mov    0x8(%ebp),%eax
c010b781:	0f b6 00             	movzbl (%eax),%eax
c010b784:	3c 2f                	cmp    $0x2f,%al
c010b786:	7e 1b                	jle    c010b7a3 <strtol+0xd0>
c010b788:	8b 45 08             	mov    0x8(%ebp),%eax
c010b78b:	0f b6 00             	movzbl (%eax),%eax
c010b78e:	3c 39                	cmp    $0x39,%al
c010b790:	7f 11                	jg     c010b7a3 <strtol+0xd0>
            dig = *s - '0';
c010b792:	8b 45 08             	mov    0x8(%ebp),%eax
c010b795:	0f b6 00             	movzbl (%eax),%eax
c010b798:	0f be c0             	movsbl %al,%eax
c010b79b:	83 e8 30             	sub    $0x30,%eax
c010b79e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b7a1:	eb 48                	jmp    c010b7eb <strtol+0x118>
        }
        else if (*s >= 'a' && *s <= 'z') {
c010b7a3:	8b 45 08             	mov    0x8(%ebp),%eax
c010b7a6:	0f b6 00             	movzbl (%eax),%eax
c010b7a9:	3c 60                	cmp    $0x60,%al
c010b7ab:	7e 1b                	jle    c010b7c8 <strtol+0xf5>
c010b7ad:	8b 45 08             	mov    0x8(%ebp),%eax
c010b7b0:	0f b6 00             	movzbl (%eax),%eax
c010b7b3:	3c 7a                	cmp    $0x7a,%al
c010b7b5:	7f 11                	jg     c010b7c8 <strtol+0xf5>
            dig = *s - 'a' + 10;
c010b7b7:	8b 45 08             	mov    0x8(%ebp),%eax
c010b7ba:	0f b6 00             	movzbl (%eax),%eax
c010b7bd:	0f be c0             	movsbl %al,%eax
c010b7c0:	83 e8 57             	sub    $0x57,%eax
c010b7c3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b7c6:	eb 23                	jmp    c010b7eb <strtol+0x118>
        }
        else if (*s >= 'A' && *s <= 'Z') {
c010b7c8:	8b 45 08             	mov    0x8(%ebp),%eax
c010b7cb:	0f b6 00             	movzbl (%eax),%eax
c010b7ce:	3c 40                	cmp    $0x40,%al
c010b7d0:	7e 3b                	jle    c010b80d <strtol+0x13a>
c010b7d2:	8b 45 08             	mov    0x8(%ebp),%eax
c010b7d5:	0f b6 00             	movzbl (%eax),%eax
c010b7d8:	3c 5a                	cmp    $0x5a,%al
c010b7da:	7f 31                	jg     c010b80d <strtol+0x13a>
            dig = *s - 'A' + 10;
c010b7dc:	8b 45 08             	mov    0x8(%ebp),%eax
c010b7df:	0f b6 00             	movzbl (%eax),%eax
c010b7e2:	0f be c0             	movsbl %al,%eax
c010b7e5:	83 e8 37             	sub    $0x37,%eax
c010b7e8:	89 45 f4             	mov    %eax,-0xc(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
c010b7eb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b7ee:	3b 45 10             	cmp    0x10(%ebp),%eax
c010b7f1:	7d 19                	jge    c010b80c <strtol+0x139>
            break;
        }
        s ++, val = (val * base) + dig;
c010b7f3:	ff 45 08             	incl   0x8(%ebp)
c010b7f6:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010b7f9:	0f af 45 10          	imul   0x10(%ebp),%eax
c010b7fd:	89 c2                	mov    %eax,%edx
c010b7ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010b802:	01 d0                	add    %edx,%eax
c010b804:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (1) {
c010b807:	e9 72 ff ff ff       	jmp    c010b77e <strtol+0xab>
            break;
c010b80c:	90                   	nop
        // we don't properly detect overflow!
    }

    if (endptr) {
c010b80d:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010b811:	74 08                	je     c010b81b <strtol+0x148>
        *endptr = (char *) s;
c010b813:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b816:	8b 55 08             	mov    0x8(%ebp),%edx
c010b819:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
c010b81b:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c010b81f:	74 07                	je     c010b828 <strtol+0x155>
c010b821:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010b824:	f7 d8                	neg    %eax
c010b826:	eb 03                	jmp    c010b82b <strtol+0x158>
c010b828:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
c010b82b:	c9                   	leave  
c010b82c:	c3                   	ret    

c010b82d <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
c010b82d:	f3 0f 1e fb          	endbr32 
c010b831:	55                   	push   %ebp
c010b832:	89 e5                	mov    %esp,%ebp
c010b834:	57                   	push   %edi
c010b835:	83 ec 24             	sub    $0x24,%esp
c010b838:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b83b:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
c010b83e:	0f be 55 d8          	movsbl -0x28(%ebp),%edx
c010b842:	8b 45 08             	mov    0x8(%ebp),%eax
c010b845:	89 45 f8             	mov    %eax,-0x8(%ebp)
c010b848:	88 55 f7             	mov    %dl,-0x9(%ebp)
c010b84b:	8b 45 10             	mov    0x10(%ebp),%eax
c010b84e:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
c010b851:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c010b854:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
c010b858:	8b 55 f8             	mov    -0x8(%ebp),%edx
c010b85b:	89 d7                	mov    %edx,%edi
c010b85d:	f3 aa                	rep stos %al,%es:(%edi)
c010b85f:	89 fa                	mov    %edi,%edx
c010b861:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c010b864:	89 55 e8             	mov    %edx,-0x18(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
c010b867:	8b 45 f8             	mov    -0x8(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
c010b86a:	83 c4 24             	add    $0x24,%esp
c010b86d:	5f                   	pop    %edi
c010b86e:	5d                   	pop    %ebp
c010b86f:	c3                   	ret    

c010b870 <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
c010b870:	f3 0f 1e fb          	endbr32 
c010b874:	55                   	push   %ebp
c010b875:	89 e5                	mov    %esp,%ebp
c010b877:	57                   	push   %edi
c010b878:	56                   	push   %esi
c010b879:	53                   	push   %ebx
c010b87a:	83 ec 30             	sub    $0x30,%esp
c010b87d:	8b 45 08             	mov    0x8(%ebp),%eax
c010b880:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010b883:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b886:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010b889:	8b 45 10             	mov    0x10(%ebp),%eax
c010b88c:	89 45 e8             	mov    %eax,-0x18(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
c010b88f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b892:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010b895:	73 42                	jae    c010b8d9 <memmove+0x69>
c010b897:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b89a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010b89d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010b8a0:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010b8a3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010b8a6:	89 45 dc             	mov    %eax,-0x24(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c010b8a9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010b8ac:	c1 e8 02             	shr    $0x2,%eax
c010b8af:	89 c1                	mov    %eax,%ecx
    asm volatile (
c010b8b1:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010b8b4:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010b8b7:	89 d7                	mov    %edx,%edi
c010b8b9:	89 c6                	mov    %eax,%esi
c010b8bb:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c010b8bd:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c010b8c0:	83 e1 03             	and    $0x3,%ecx
c010b8c3:	74 02                	je     c010b8c7 <memmove+0x57>
c010b8c5:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010b8c7:	89 f0                	mov    %esi,%eax
c010b8c9:	89 fa                	mov    %edi,%edx
c010b8cb:	89 4d d8             	mov    %ecx,-0x28(%ebp)
c010b8ce:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c010b8d1:	89 45 d0             	mov    %eax,-0x30(%ebp)
        : "memory");
    return dst;
c010b8d4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
        return __memcpy(dst, src, n);
c010b8d7:	eb 36                	jmp    c010b90f <memmove+0x9f>
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
c010b8d9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010b8dc:	8d 50 ff             	lea    -0x1(%eax),%edx
c010b8df:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010b8e2:	01 c2                	add    %eax,%edx
c010b8e4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010b8e7:	8d 48 ff             	lea    -0x1(%eax),%ecx
c010b8ea:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b8ed:	8d 1c 01             	lea    (%ecx,%eax,1),%ebx
    asm volatile (
c010b8f0:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010b8f3:	89 c1                	mov    %eax,%ecx
c010b8f5:	89 d8                	mov    %ebx,%eax
c010b8f7:	89 d6                	mov    %edx,%esi
c010b8f9:	89 c7                	mov    %eax,%edi
c010b8fb:	fd                   	std    
c010b8fc:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010b8fe:	fc                   	cld    
c010b8ff:	89 f8                	mov    %edi,%eax
c010b901:	89 f2                	mov    %esi,%edx
c010b903:	89 4d cc             	mov    %ecx,-0x34(%ebp)
c010b906:	89 55 c8             	mov    %edx,-0x38(%ebp)
c010b909:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return dst;
c010b90c:	8b 45 f0             	mov    -0x10(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
c010b90f:	83 c4 30             	add    $0x30,%esp
c010b912:	5b                   	pop    %ebx
c010b913:	5e                   	pop    %esi
c010b914:	5f                   	pop    %edi
c010b915:	5d                   	pop    %ebp
c010b916:	c3                   	ret    

c010b917 <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
c010b917:	f3 0f 1e fb          	endbr32 
c010b91b:	55                   	push   %ebp
c010b91c:	89 e5                	mov    %esp,%ebp
c010b91e:	57                   	push   %edi
c010b91f:	56                   	push   %esi
c010b920:	83 ec 20             	sub    $0x20,%esp
c010b923:	8b 45 08             	mov    0x8(%ebp),%eax
c010b926:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b929:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b92c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010b92f:	8b 45 10             	mov    0x10(%ebp),%eax
c010b932:	89 45 ec             	mov    %eax,-0x14(%ebp)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c010b935:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010b938:	c1 e8 02             	shr    $0x2,%eax
c010b93b:	89 c1                	mov    %eax,%ecx
    asm volatile (
c010b93d:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010b940:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b943:	89 d7                	mov    %edx,%edi
c010b945:	89 c6                	mov    %eax,%esi
c010b947:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c010b949:	8b 4d ec             	mov    -0x14(%ebp),%ecx
c010b94c:	83 e1 03             	and    $0x3,%ecx
c010b94f:	74 02                	je     c010b953 <memcpy+0x3c>
c010b951:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010b953:	89 f0                	mov    %esi,%eax
c010b955:	89 fa                	mov    %edi,%edx
c010b957:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c010b95a:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010b95d:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return dst;
c010b960:	8b 45 f4             	mov    -0xc(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
c010b963:	83 c4 20             	add    $0x20,%esp
c010b966:	5e                   	pop    %esi
c010b967:	5f                   	pop    %edi
c010b968:	5d                   	pop    %ebp
c010b969:	c3                   	ret    

c010b96a <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
c010b96a:	f3 0f 1e fb          	endbr32 
c010b96e:	55                   	push   %ebp
c010b96f:	89 e5                	mov    %esp,%ebp
c010b971:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
c010b974:	8b 45 08             	mov    0x8(%ebp),%eax
c010b977:	89 45 fc             	mov    %eax,-0x4(%ebp)
    const char *s2 = (const char *)v2;
c010b97a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010b97d:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (n -- > 0) {
c010b980:	eb 2e                	jmp    c010b9b0 <memcmp+0x46>
        if (*s1 != *s2) {
c010b982:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010b985:	0f b6 10             	movzbl (%eax),%edx
c010b988:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010b98b:	0f b6 00             	movzbl (%eax),%eax
c010b98e:	38 c2                	cmp    %al,%dl
c010b990:	74 18                	je     c010b9aa <memcmp+0x40>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
c010b992:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010b995:	0f b6 00             	movzbl (%eax),%eax
c010b998:	0f b6 d0             	movzbl %al,%edx
c010b99b:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010b99e:	0f b6 00             	movzbl (%eax),%eax
c010b9a1:	0f b6 c0             	movzbl %al,%eax
c010b9a4:	29 c2                	sub    %eax,%edx
c010b9a6:	89 d0                	mov    %edx,%eax
c010b9a8:	eb 18                	jmp    c010b9c2 <memcmp+0x58>
        }
        s1 ++, s2 ++;
c010b9aa:	ff 45 fc             	incl   -0x4(%ebp)
c010b9ad:	ff 45 f8             	incl   -0x8(%ebp)
    while (n -- > 0) {
c010b9b0:	8b 45 10             	mov    0x10(%ebp),%eax
c010b9b3:	8d 50 ff             	lea    -0x1(%eax),%edx
c010b9b6:	89 55 10             	mov    %edx,0x10(%ebp)
c010b9b9:	85 c0                	test   %eax,%eax
c010b9bb:	75 c5                	jne    c010b982 <memcmp+0x18>
    }
    return 0;
c010b9bd:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010b9c2:	c9                   	leave  
c010b9c3:	c3                   	ret    

c010b9c4 <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
c010b9c4:	f3 0f 1e fb          	endbr32 
c010b9c8:	55                   	push   %ebp
c010b9c9:	89 e5                	mov    %esp,%ebp
c010b9cb:	83 ec 58             	sub    $0x58,%esp
c010b9ce:	8b 45 10             	mov    0x10(%ebp),%eax
c010b9d1:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010b9d4:	8b 45 14             	mov    0x14(%ebp),%eax
c010b9d7:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
c010b9da:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010b9dd:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010b9e0:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010b9e3:	89 55 ec             	mov    %edx,-0x14(%ebp)
    unsigned mod = do_div(result, base);
c010b9e6:	8b 45 18             	mov    0x18(%ebp),%eax
c010b9e9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010b9ec:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010b9ef:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010b9f2:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010b9f5:	89 55 f0             	mov    %edx,-0x10(%ebp)
c010b9f8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010b9fb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010b9fe:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010ba02:	74 1c                	je     c010ba20 <printnum+0x5c>
c010ba04:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010ba07:	ba 00 00 00 00       	mov    $0x0,%edx
c010ba0c:	f7 75 e4             	divl   -0x1c(%ebp)
c010ba0f:	89 55 f4             	mov    %edx,-0xc(%ebp)
c010ba12:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010ba15:	ba 00 00 00 00       	mov    $0x0,%edx
c010ba1a:	f7 75 e4             	divl   -0x1c(%ebp)
c010ba1d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010ba20:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010ba23:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010ba26:	f7 75 e4             	divl   -0x1c(%ebp)
c010ba29:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010ba2c:	89 55 dc             	mov    %edx,-0x24(%ebp)
c010ba2f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010ba32:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010ba35:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010ba38:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010ba3b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010ba3e:	89 45 d8             	mov    %eax,-0x28(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
c010ba41:	8b 45 18             	mov    0x18(%ebp),%eax
c010ba44:	ba 00 00 00 00       	mov    $0x0,%edx
c010ba49:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c010ba4c:	39 45 d0             	cmp    %eax,-0x30(%ebp)
c010ba4f:	19 d1                	sbb    %edx,%ecx
c010ba51:	72 4c                	jb     c010ba9f <printnum+0xdb>
        printnum(putch, putdat, result, base, width - 1, padc);
c010ba53:	8b 45 1c             	mov    0x1c(%ebp),%eax
c010ba56:	8d 50 ff             	lea    -0x1(%eax),%edx
c010ba59:	8b 45 20             	mov    0x20(%ebp),%eax
c010ba5c:	89 44 24 18          	mov    %eax,0x18(%esp)
c010ba60:	89 54 24 14          	mov    %edx,0x14(%esp)
c010ba64:	8b 45 18             	mov    0x18(%ebp),%eax
c010ba67:	89 44 24 10          	mov    %eax,0x10(%esp)
c010ba6b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010ba6e:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010ba71:	89 44 24 08          	mov    %eax,0x8(%esp)
c010ba75:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010ba79:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ba7c:	89 44 24 04          	mov    %eax,0x4(%esp)
c010ba80:	8b 45 08             	mov    0x8(%ebp),%eax
c010ba83:	89 04 24             	mov    %eax,(%esp)
c010ba86:	e8 39 ff ff ff       	call   c010b9c4 <printnum>
c010ba8b:	eb 1b                	jmp    c010baa8 <printnum+0xe4>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat);
c010ba8d:	8b 45 0c             	mov    0xc(%ebp),%eax
c010ba90:	89 44 24 04          	mov    %eax,0x4(%esp)
c010ba94:	8b 45 20             	mov    0x20(%ebp),%eax
c010ba97:	89 04 24             	mov    %eax,(%esp)
c010ba9a:	8b 45 08             	mov    0x8(%ebp),%eax
c010ba9d:	ff d0                	call   *%eax
        while (-- width > 0)
c010ba9f:	ff 4d 1c             	decl   0x1c(%ebp)
c010baa2:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c010baa6:	7f e5                	jg     c010ba8d <printnum+0xc9>
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
c010baa8:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010baab:	05 04 e8 10 c0       	add    $0xc010e804,%eax
c010bab0:	0f b6 00             	movzbl (%eax),%eax
c010bab3:	0f be c0             	movsbl %al,%eax
c010bab6:	8b 55 0c             	mov    0xc(%ebp),%edx
c010bab9:	89 54 24 04          	mov    %edx,0x4(%esp)
c010babd:	89 04 24             	mov    %eax,(%esp)
c010bac0:	8b 45 08             	mov    0x8(%ebp),%eax
c010bac3:	ff d0                	call   *%eax
}
c010bac5:	90                   	nop
c010bac6:	c9                   	leave  
c010bac7:	c3                   	ret    

c010bac8 <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
c010bac8:	f3 0f 1e fb          	endbr32 
c010bacc:	55                   	push   %ebp
c010bacd:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c010bacf:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c010bad3:	7e 14                	jle    c010bae9 <getuint+0x21>
        return va_arg(*ap, unsigned long long);
c010bad5:	8b 45 08             	mov    0x8(%ebp),%eax
c010bad8:	8b 00                	mov    (%eax),%eax
c010bada:	8d 48 08             	lea    0x8(%eax),%ecx
c010badd:	8b 55 08             	mov    0x8(%ebp),%edx
c010bae0:	89 0a                	mov    %ecx,(%edx)
c010bae2:	8b 50 04             	mov    0x4(%eax),%edx
c010bae5:	8b 00                	mov    (%eax),%eax
c010bae7:	eb 30                	jmp    c010bb19 <getuint+0x51>
    }
    else if (lflag) {
c010bae9:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010baed:	74 16                	je     c010bb05 <getuint+0x3d>
        return va_arg(*ap, unsigned long);
c010baef:	8b 45 08             	mov    0x8(%ebp),%eax
c010baf2:	8b 00                	mov    (%eax),%eax
c010baf4:	8d 48 04             	lea    0x4(%eax),%ecx
c010baf7:	8b 55 08             	mov    0x8(%ebp),%edx
c010bafa:	89 0a                	mov    %ecx,(%edx)
c010bafc:	8b 00                	mov    (%eax),%eax
c010bafe:	ba 00 00 00 00       	mov    $0x0,%edx
c010bb03:	eb 14                	jmp    c010bb19 <getuint+0x51>
    }
    else {
        return va_arg(*ap, unsigned int);
c010bb05:	8b 45 08             	mov    0x8(%ebp),%eax
c010bb08:	8b 00                	mov    (%eax),%eax
c010bb0a:	8d 48 04             	lea    0x4(%eax),%ecx
c010bb0d:	8b 55 08             	mov    0x8(%ebp),%edx
c010bb10:	89 0a                	mov    %ecx,(%edx)
c010bb12:	8b 00                	mov    (%eax),%eax
c010bb14:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
c010bb19:	5d                   	pop    %ebp
c010bb1a:	c3                   	ret    

c010bb1b <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
c010bb1b:	f3 0f 1e fb          	endbr32 
c010bb1f:	55                   	push   %ebp
c010bb20:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c010bb22:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c010bb26:	7e 14                	jle    c010bb3c <getint+0x21>
        return va_arg(*ap, long long);
c010bb28:	8b 45 08             	mov    0x8(%ebp),%eax
c010bb2b:	8b 00                	mov    (%eax),%eax
c010bb2d:	8d 48 08             	lea    0x8(%eax),%ecx
c010bb30:	8b 55 08             	mov    0x8(%ebp),%edx
c010bb33:	89 0a                	mov    %ecx,(%edx)
c010bb35:	8b 50 04             	mov    0x4(%eax),%edx
c010bb38:	8b 00                	mov    (%eax),%eax
c010bb3a:	eb 28                	jmp    c010bb64 <getint+0x49>
    }
    else if (lflag) {
c010bb3c:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010bb40:	74 12                	je     c010bb54 <getint+0x39>
        return va_arg(*ap, long);
c010bb42:	8b 45 08             	mov    0x8(%ebp),%eax
c010bb45:	8b 00                	mov    (%eax),%eax
c010bb47:	8d 48 04             	lea    0x4(%eax),%ecx
c010bb4a:	8b 55 08             	mov    0x8(%ebp),%edx
c010bb4d:	89 0a                	mov    %ecx,(%edx)
c010bb4f:	8b 00                	mov    (%eax),%eax
c010bb51:	99                   	cltd   
c010bb52:	eb 10                	jmp    c010bb64 <getint+0x49>
    }
    else {
        return va_arg(*ap, int);
c010bb54:	8b 45 08             	mov    0x8(%ebp),%eax
c010bb57:	8b 00                	mov    (%eax),%eax
c010bb59:	8d 48 04             	lea    0x4(%eax),%ecx
c010bb5c:	8b 55 08             	mov    0x8(%ebp),%edx
c010bb5f:	89 0a                	mov    %ecx,(%edx)
c010bb61:	8b 00                	mov    (%eax),%eax
c010bb63:	99                   	cltd   
    }
}
c010bb64:	5d                   	pop    %ebp
c010bb65:	c3                   	ret    

c010bb66 <printfmt>:
 * @putch:      specified putch function, print a single character
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
c010bb66:	f3 0f 1e fb          	endbr32 
c010bb6a:	55                   	push   %ebp
c010bb6b:	89 e5                	mov    %esp,%ebp
c010bb6d:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
c010bb70:	8d 45 14             	lea    0x14(%ebp),%eax
c010bb73:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, putdat, fmt, ap);
c010bb76:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010bb79:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010bb7d:	8b 45 10             	mov    0x10(%ebp),%eax
c010bb80:	89 44 24 08          	mov    %eax,0x8(%esp)
c010bb84:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bb87:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bb8b:	8b 45 08             	mov    0x8(%ebp),%eax
c010bb8e:	89 04 24             	mov    %eax,(%esp)
c010bb91:	e8 03 00 00 00       	call   c010bb99 <vprintfmt>
    va_end(ap);
}
c010bb96:	90                   	nop
c010bb97:	c9                   	leave  
c010bb98:	c3                   	ret    

c010bb99 <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
c010bb99:	f3 0f 1e fb          	endbr32 
c010bb9d:	55                   	push   %ebp
c010bb9e:	89 e5                	mov    %esp,%ebp
c010bba0:	56                   	push   %esi
c010bba1:	53                   	push   %ebx
c010bba2:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c010bba5:	eb 17                	jmp    c010bbbe <vprintfmt+0x25>
            if (ch == '\0') {
c010bba7:	85 db                	test   %ebx,%ebx
c010bba9:	0f 84 c0 03 00 00    	je     c010bf6f <vprintfmt+0x3d6>
                return;
            }
            putch(ch, putdat);
c010bbaf:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bbb2:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bbb6:	89 1c 24             	mov    %ebx,(%esp)
c010bbb9:	8b 45 08             	mov    0x8(%ebp),%eax
c010bbbc:	ff d0                	call   *%eax
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c010bbbe:	8b 45 10             	mov    0x10(%ebp),%eax
c010bbc1:	8d 50 01             	lea    0x1(%eax),%edx
c010bbc4:	89 55 10             	mov    %edx,0x10(%ebp)
c010bbc7:	0f b6 00             	movzbl (%eax),%eax
c010bbca:	0f b6 d8             	movzbl %al,%ebx
c010bbcd:	83 fb 25             	cmp    $0x25,%ebx
c010bbd0:	75 d5                	jne    c010bba7 <vprintfmt+0xe>
        }

        // Process a %-escape sequence
        char padc = ' ';
c010bbd2:	c6 45 db 20          	movb   $0x20,-0x25(%ebp)
        width = precision = -1;
c010bbd6:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
c010bbdd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010bbe0:	89 45 e8             	mov    %eax,-0x18(%ebp)
        lflag = altflag = 0;
c010bbe3:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c010bbea:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010bbed:	89 45 e0             	mov    %eax,-0x20(%ebp)

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
c010bbf0:	8b 45 10             	mov    0x10(%ebp),%eax
c010bbf3:	8d 50 01             	lea    0x1(%eax),%edx
c010bbf6:	89 55 10             	mov    %edx,0x10(%ebp)
c010bbf9:	0f b6 00             	movzbl (%eax),%eax
c010bbfc:	0f b6 d8             	movzbl %al,%ebx
c010bbff:	8d 43 dd             	lea    -0x23(%ebx),%eax
c010bc02:	83 f8 55             	cmp    $0x55,%eax
c010bc05:	0f 87 38 03 00 00    	ja     c010bf43 <vprintfmt+0x3aa>
c010bc0b:	8b 04 85 28 e8 10 c0 	mov    -0x3fef17d8(,%eax,4),%eax
c010bc12:	3e ff e0             	notrack jmp *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
c010bc15:	c6 45 db 2d          	movb   $0x2d,-0x25(%ebp)
            goto reswitch;
c010bc19:	eb d5                	jmp    c010bbf0 <vprintfmt+0x57>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
c010bc1b:	c6 45 db 30          	movb   $0x30,-0x25(%ebp)
            goto reswitch;
c010bc1f:	eb cf                	jmp    c010bbf0 <vprintfmt+0x57>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c010bc21:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                precision = precision * 10 + ch - '0';
c010bc28:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010bc2b:	89 d0                	mov    %edx,%eax
c010bc2d:	c1 e0 02             	shl    $0x2,%eax
c010bc30:	01 d0                	add    %edx,%eax
c010bc32:	01 c0                	add    %eax,%eax
c010bc34:	01 d8                	add    %ebx,%eax
c010bc36:	83 e8 30             	sub    $0x30,%eax
c010bc39:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                ch = *fmt;
c010bc3c:	8b 45 10             	mov    0x10(%ebp),%eax
c010bc3f:	0f b6 00             	movzbl (%eax),%eax
c010bc42:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
c010bc45:	83 fb 2f             	cmp    $0x2f,%ebx
c010bc48:	7e 38                	jle    c010bc82 <vprintfmt+0xe9>
c010bc4a:	83 fb 39             	cmp    $0x39,%ebx
c010bc4d:	7f 33                	jg     c010bc82 <vprintfmt+0xe9>
            for (precision = 0; ; ++ fmt) {
c010bc4f:	ff 45 10             	incl   0x10(%ebp)
                precision = precision * 10 + ch - '0';
c010bc52:	eb d4                	jmp    c010bc28 <vprintfmt+0x8f>
                }
            }
            goto process_precision;

        case '*':
            precision = va_arg(ap, int);
c010bc54:	8b 45 14             	mov    0x14(%ebp),%eax
c010bc57:	8d 50 04             	lea    0x4(%eax),%edx
c010bc5a:	89 55 14             	mov    %edx,0x14(%ebp)
c010bc5d:	8b 00                	mov    (%eax),%eax
c010bc5f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            goto process_precision;
c010bc62:	eb 1f                	jmp    c010bc83 <vprintfmt+0xea>

        case '.':
            if (width < 0)
c010bc64:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010bc68:	79 86                	jns    c010bbf0 <vprintfmt+0x57>
                width = 0;
c010bc6a:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
            goto reswitch;
c010bc71:	e9 7a ff ff ff       	jmp    c010bbf0 <vprintfmt+0x57>

        case '#':
            altflag = 1;
c010bc76:	c7 45 dc 01 00 00 00 	movl   $0x1,-0x24(%ebp)
            goto reswitch;
c010bc7d:	e9 6e ff ff ff       	jmp    c010bbf0 <vprintfmt+0x57>
            goto process_precision;
c010bc82:	90                   	nop

        process_precision:
            if (width < 0)
c010bc83:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010bc87:	0f 89 63 ff ff ff    	jns    c010bbf0 <vprintfmt+0x57>
                width = precision, precision = -1;
c010bc8d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010bc90:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010bc93:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
            goto reswitch;
c010bc9a:	e9 51 ff ff ff       	jmp    c010bbf0 <vprintfmt+0x57>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
c010bc9f:	ff 45 e0             	incl   -0x20(%ebp)
            goto reswitch;
c010bca2:	e9 49 ff ff ff       	jmp    c010bbf0 <vprintfmt+0x57>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat);
c010bca7:	8b 45 14             	mov    0x14(%ebp),%eax
c010bcaa:	8d 50 04             	lea    0x4(%eax),%edx
c010bcad:	89 55 14             	mov    %edx,0x14(%ebp)
c010bcb0:	8b 00                	mov    (%eax),%eax
c010bcb2:	8b 55 0c             	mov    0xc(%ebp),%edx
c010bcb5:	89 54 24 04          	mov    %edx,0x4(%esp)
c010bcb9:	89 04 24             	mov    %eax,(%esp)
c010bcbc:	8b 45 08             	mov    0x8(%ebp),%eax
c010bcbf:	ff d0                	call   *%eax
            break;
c010bcc1:	e9 a4 02 00 00       	jmp    c010bf6a <vprintfmt+0x3d1>

        // error message
        case 'e':
            err = va_arg(ap, int);
c010bcc6:	8b 45 14             	mov    0x14(%ebp),%eax
c010bcc9:	8d 50 04             	lea    0x4(%eax),%edx
c010bccc:	89 55 14             	mov    %edx,0x14(%ebp)
c010bccf:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
c010bcd1:	85 db                	test   %ebx,%ebx
c010bcd3:	79 02                	jns    c010bcd7 <vprintfmt+0x13e>
                err = -err;
c010bcd5:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
c010bcd7:	83 fb 18             	cmp    $0x18,%ebx
c010bcda:	7f 0b                	jg     c010bce7 <vprintfmt+0x14e>
c010bcdc:	8b 34 9d a0 e7 10 c0 	mov    -0x3fef1860(,%ebx,4),%esi
c010bce3:	85 f6                	test   %esi,%esi
c010bce5:	75 23                	jne    c010bd0a <vprintfmt+0x171>
                printfmt(putch, putdat, "error %d", err);
c010bce7:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c010bceb:	c7 44 24 08 15 e8 10 	movl   $0xc010e815,0x8(%esp)
c010bcf2:	c0 
c010bcf3:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bcf6:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bcfa:	8b 45 08             	mov    0x8(%ebp),%eax
c010bcfd:	89 04 24             	mov    %eax,(%esp)
c010bd00:	e8 61 fe ff ff       	call   c010bb66 <printfmt>
            }
            else {
                printfmt(putch, putdat, "%s", p);
            }
            break;
c010bd05:	e9 60 02 00 00       	jmp    c010bf6a <vprintfmt+0x3d1>
                printfmt(putch, putdat, "%s", p);
c010bd0a:	89 74 24 0c          	mov    %esi,0xc(%esp)
c010bd0e:	c7 44 24 08 1e e8 10 	movl   $0xc010e81e,0x8(%esp)
c010bd15:	c0 
c010bd16:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bd19:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bd1d:	8b 45 08             	mov    0x8(%ebp),%eax
c010bd20:	89 04 24             	mov    %eax,(%esp)
c010bd23:	e8 3e fe ff ff       	call   c010bb66 <printfmt>
            break;
c010bd28:	e9 3d 02 00 00       	jmp    c010bf6a <vprintfmt+0x3d1>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
c010bd2d:	8b 45 14             	mov    0x14(%ebp),%eax
c010bd30:	8d 50 04             	lea    0x4(%eax),%edx
c010bd33:	89 55 14             	mov    %edx,0x14(%ebp)
c010bd36:	8b 30                	mov    (%eax),%esi
c010bd38:	85 f6                	test   %esi,%esi
c010bd3a:	75 05                	jne    c010bd41 <vprintfmt+0x1a8>
                p = "(null)";
c010bd3c:	be 21 e8 10 c0       	mov    $0xc010e821,%esi
            }
            if (width > 0 && padc != '-') {
c010bd41:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010bd45:	7e 76                	jle    c010bdbd <vprintfmt+0x224>
c010bd47:	80 7d db 2d          	cmpb   $0x2d,-0x25(%ebp)
c010bd4b:	74 70                	je     c010bdbd <vprintfmt+0x224>
                for (width -= strnlen(p, precision); width > 0; width --) {
c010bd4d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010bd50:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bd54:	89 34 24             	mov    %esi,(%esp)
c010bd57:	e8 ba f7 ff ff       	call   c010b516 <strnlen>
c010bd5c:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010bd5f:	29 c2                	sub    %eax,%edx
c010bd61:	89 d0                	mov    %edx,%eax
c010bd63:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010bd66:	eb 16                	jmp    c010bd7e <vprintfmt+0x1e5>
                    putch(padc, putdat);
c010bd68:	0f be 45 db          	movsbl -0x25(%ebp),%eax
c010bd6c:	8b 55 0c             	mov    0xc(%ebp),%edx
c010bd6f:	89 54 24 04          	mov    %edx,0x4(%esp)
c010bd73:	89 04 24             	mov    %eax,(%esp)
c010bd76:	8b 45 08             	mov    0x8(%ebp),%eax
c010bd79:	ff d0                	call   *%eax
                for (width -= strnlen(p, precision); width > 0; width --) {
c010bd7b:	ff 4d e8             	decl   -0x18(%ebp)
c010bd7e:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010bd82:	7f e4                	jg     c010bd68 <vprintfmt+0x1cf>
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c010bd84:	eb 37                	jmp    c010bdbd <vprintfmt+0x224>
                if (altflag && (ch < ' ' || ch > '~')) {
c010bd86:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c010bd8a:	74 1f                	je     c010bdab <vprintfmt+0x212>
c010bd8c:	83 fb 1f             	cmp    $0x1f,%ebx
c010bd8f:	7e 05                	jle    c010bd96 <vprintfmt+0x1fd>
c010bd91:	83 fb 7e             	cmp    $0x7e,%ebx
c010bd94:	7e 15                	jle    c010bdab <vprintfmt+0x212>
                    putch('?', putdat);
c010bd96:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bd99:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bd9d:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
c010bda4:	8b 45 08             	mov    0x8(%ebp),%eax
c010bda7:	ff d0                	call   *%eax
c010bda9:	eb 0f                	jmp    c010bdba <vprintfmt+0x221>
                }
                else {
                    putch(ch, putdat);
c010bdab:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bdae:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bdb2:	89 1c 24             	mov    %ebx,(%esp)
c010bdb5:	8b 45 08             	mov    0x8(%ebp),%eax
c010bdb8:	ff d0                	call   *%eax
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c010bdba:	ff 4d e8             	decl   -0x18(%ebp)
c010bdbd:	89 f0                	mov    %esi,%eax
c010bdbf:	8d 70 01             	lea    0x1(%eax),%esi
c010bdc2:	0f b6 00             	movzbl (%eax),%eax
c010bdc5:	0f be d8             	movsbl %al,%ebx
c010bdc8:	85 db                	test   %ebx,%ebx
c010bdca:	74 27                	je     c010bdf3 <vprintfmt+0x25a>
c010bdcc:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010bdd0:	78 b4                	js     c010bd86 <vprintfmt+0x1ed>
c010bdd2:	ff 4d e4             	decl   -0x1c(%ebp)
c010bdd5:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010bdd9:	79 ab                	jns    c010bd86 <vprintfmt+0x1ed>
                }
            }
            for (; width > 0; width --) {
c010bddb:	eb 16                	jmp    c010bdf3 <vprintfmt+0x25a>
                putch(' ', putdat);
c010bddd:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bde0:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bde4:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c010bdeb:	8b 45 08             	mov    0x8(%ebp),%eax
c010bdee:	ff d0                	call   *%eax
            for (; width > 0; width --) {
c010bdf0:	ff 4d e8             	decl   -0x18(%ebp)
c010bdf3:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010bdf7:	7f e4                	jg     c010bddd <vprintfmt+0x244>
            }
            break;
c010bdf9:	e9 6c 01 00 00       	jmp    c010bf6a <vprintfmt+0x3d1>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
c010bdfe:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010be01:	89 44 24 04          	mov    %eax,0x4(%esp)
c010be05:	8d 45 14             	lea    0x14(%ebp),%eax
c010be08:	89 04 24             	mov    %eax,(%esp)
c010be0b:	e8 0b fd ff ff       	call   c010bb1b <getint>
c010be10:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010be13:	89 55 f4             	mov    %edx,-0xc(%ebp)
            if ((long long)num < 0) {
c010be16:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010be19:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010be1c:	85 d2                	test   %edx,%edx
c010be1e:	79 26                	jns    c010be46 <vprintfmt+0x2ad>
                putch('-', putdat);
c010be20:	8b 45 0c             	mov    0xc(%ebp),%eax
c010be23:	89 44 24 04          	mov    %eax,0x4(%esp)
c010be27:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
c010be2e:	8b 45 08             	mov    0x8(%ebp),%eax
c010be31:	ff d0                	call   *%eax
                num = -(long long)num;
c010be33:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010be36:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010be39:	f7 d8                	neg    %eax
c010be3b:	83 d2 00             	adc    $0x0,%edx
c010be3e:	f7 da                	neg    %edx
c010be40:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010be43:	89 55 f4             	mov    %edx,-0xc(%ebp)
            }
            base = 10;
c010be46:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c010be4d:	e9 a8 00 00 00       	jmp    c010befa <vprintfmt+0x361>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
c010be52:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010be55:	89 44 24 04          	mov    %eax,0x4(%esp)
c010be59:	8d 45 14             	lea    0x14(%ebp),%eax
c010be5c:	89 04 24             	mov    %eax,(%esp)
c010be5f:	e8 64 fc ff ff       	call   c010bac8 <getuint>
c010be64:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010be67:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 10;
c010be6a:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c010be71:	e9 84 00 00 00       	jmp    c010befa <vprintfmt+0x361>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
c010be76:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010be79:	89 44 24 04          	mov    %eax,0x4(%esp)
c010be7d:	8d 45 14             	lea    0x14(%ebp),%eax
c010be80:	89 04 24             	mov    %eax,(%esp)
c010be83:	e8 40 fc ff ff       	call   c010bac8 <getuint>
c010be88:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010be8b:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 8;
c010be8e:	c7 45 ec 08 00 00 00 	movl   $0x8,-0x14(%ebp)
            goto number;
c010be95:	eb 63                	jmp    c010befa <vprintfmt+0x361>

        // pointer
        case 'p':
            putch('0', putdat);
c010be97:	8b 45 0c             	mov    0xc(%ebp),%eax
c010be9a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010be9e:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
c010bea5:	8b 45 08             	mov    0x8(%ebp),%eax
c010bea8:	ff d0                	call   *%eax
            putch('x', putdat);
c010beaa:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bead:	89 44 24 04          	mov    %eax,0x4(%esp)
c010beb1:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
c010beb8:	8b 45 08             	mov    0x8(%ebp),%eax
c010bebb:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
c010bebd:	8b 45 14             	mov    0x14(%ebp),%eax
c010bec0:	8d 50 04             	lea    0x4(%eax),%edx
c010bec3:	89 55 14             	mov    %edx,0x14(%ebp)
c010bec6:	8b 00                	mov    (%eax),%eax
c010bec8:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010becb:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
            base = 16;
c010bed2:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
            goto number;
c010bed9:	eb 1f                	jmp    c010befa <vprintfmt+0x361>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
c010bedb:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010bede:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bee2:	8d 45 14             	lea    0x14(%ebp),%eax
c010bee5:	89 04 24             	mov    %eax,(%esp)
c010bee8:	e8 db fb ff ff       	call   c010bac8 <getuint>
c010beed:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010bef0:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 16;
c010bef3:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
        number:
            printnum(putch, putdat, num, base, width, padc);
c010befa:	0f be 55 db          	movsbl -0x25(%ebp),%edx
c010befe:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010bf01:	89 54 24 18          	mov    %edx,0x18(%esp)
c010bf05:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010bf08:	89 54 24 14          	mov    %edx,0x14(%esp)
c010bf0c:	89 44 24 10          	mov    %eax,0x10(%esp)
c010bf10:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010bf13:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010bf16:	89 44 24 08          	mov    %eax,0x8(%esp)
c010bf1a:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010bf1e:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf21:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bf25:	8b 45 08             	mov    0x8(%ebp),%eax
c010bf28:	89 04 24             	mov    %eax,(%esp)
c010bf2b:	e8 94 fa ff ff       	call   c010b9c4 <printnum>
            break;
c010bf30:	eb 38                	jmp    c010bf6a <vprintfmt+0x3d1>

        // escaped '%' character
        case '%':
            putch(ch, putdat);
c010bf32:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf35:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bf39:	89 1c 24             	mov    %ebx,(%esp)
c010bf3c:	8b 45 08             	mov    0x8(%ebp),%eax
c010bf3f:	ff d0                	call   *%eax
            break;
c010bf41:	eb 27                	jmp    c010bf6a <vprintfmt+0x3d1>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat);
c010bf43:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf46:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bf4a:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
c010bf51:	8b 45 08             	mov    0x8(%ebp),%eax
c010bf54:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
c010bf56:	ff 4d 10             	decl   0x10(%ebp)
c010bf59:	eb 03                	jmp    c010bf5e <vprintfmt+0x3c5>
c010bf5b:	ff 4d 10             	decl   0x10(%ebp)
c010bf5e:	8b 45 10             	mov    0x10(%ebp),%eax
c010bf61:	48                   	dec    %eax
c010bf62:	0f b6 00             	movzbl (%eax),%eax
c010bf65:	3c 25                	cmp    $0x25,%al
c010bf67:	75 f2                	jne    c010bf5b <vprintfmt+0x3c2>
                /* do nothing */;
            break;
c010bf69:	90                   	nop
    while (1) {
c010bf6a:	e9 36 fc ff ff       	jmp    c010bba5 <vprintfmt+0xc>
                return;
c010bf6f:	90                   	nop
        }
    }
}
c010bf70:	83 c4 40             	add    $0x40,%esp
c010bf73:	5b                   	pop    %ebx
c010bf74:	5e                   	pop    %esi
c010bf75:	5d                   	pop    %ebp
c010bf76:	c3                   	ret    

c010bf77 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
c010bf77:	f3 0f 1e fb          	endbr32 
c010bf7b:	55                   	push   %ebp
c010bf7c:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
c010bf7e:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf81:	8b 40 08             	mov    0x8(%eax),%eax
c010bf84:	8d 50 01             	lea    0x1(%eax),%edx
c010bf87:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf8a:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
c010bf8d:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf90:	8b 10                	mov    (%eax),%edx
c010bf92:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf95:	8b 40 04             	mov    0x4(%eax),%eax
c010bf98:	39 c2                	cmp    %eax,%edx
c010bf9a:	73 12                	jae    c010bfae <sprintputch+0x37>
        *b->buf ++ = ch;
c010bf9c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bf9f:	8b 00                	mov    (%eax),%eax
c010bfa1:	8d 48 01             	lea    0x1(%eax),%ecx
c010bfa4:	8b 55 0c             	mov    0xc(%ebp),%edx
c010bfa7:	89 0a                	mov    %ecx,(%edx)
c010bfa9:	8b 55 08             	mov    0x8(%ebp),%edx
c010bfac:	88 10                	mov    %dl,(%eax)
    }
}
c010bfae:	90                   	nop
c010bfaf:	5d                   	pop    %ebp
c010bfb0:	c3                   	ret    

c010bfb1 <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
c010bfb1:	f3 0f 1e fb          	endbr32 
c010bfb5:	55                   	push   %ebp
c010bfb6:	89 e5                	mov    %esp,%ebp
c010bfb8:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c010bfbb:	8d 45 14             	lea    0x14(%ebp),%eax
c010bfbe:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
c010bfc1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010bfc4:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010bfc8:	8b 45 10             	mov    0x10(%ebp),%eax
c010bfcb:	89 44 24 08          	mov    %eax,0x8(%esp)
c010bfcf:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bfd2:	89 44 24 04          	mov    %eax,0x4(%esp)
c010bfd6:	8b 45 08             	mov    0x8(%ebp),%eax
c010bfd9:	89 04 24             	mov    %eax,(%esp)
c010bfdc:	e8 08 00 00 00       	call   c010bfe9 <vsnprintf>
c010bfe1:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c010bfe4:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010bfe7:	c9                   	leave  
c010bfe8:	c3                   	ret    

c010bfe9 <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
c010bfe9:	f3 0f 1e fb          	endbr32 
c010bfed:	55                   	push   %ebp
c010bfee:	89 e5                	mov    %esp,%ebp
c010bff0:	83 ec 28             	sub    $0x28,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
c010bff3:	8b 45 08             	mov    0x8(%ebp),%eax
c010bff6:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010bff9:	8b 45 0c             	mov    0xc(%ebp),%eax
c010bffc:	8d 50 ff             	lea    -0x1(%eax),%edx
c010bfff:	8b 45 08             	mov    0x8(%ebp),%eax
c010c002:	01 d0                	add    %edx,%eax
c010c004:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010c007:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
c010c00e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010c012:	74 0a                	je     c010c01e <vsnprintf+0x35>
c010c014:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010c017:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010c01a:	39 c2                	cmp    %eax,%edx
c010c01c:	76 07                	jbe    c010c025 <vsnprintf+0x3c>
        return -E_INVAL;
c010c01e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c010c023:	eb 2a                	jmp    c010c04f <vsnprintf+0x66>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, &b, fmt, ap);
c010c025:	8b 45 14             	mov    0x14(%ebp),%eax
c010c028:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010c02c:	8b 45 10             	mov    0x10(%ebp),%eax
c010c02f:	89 44 24 08          	mov    %eax,0x8(%esp)
c010c033:	8d 45 ec             	lea    -0x14(%ebp),%eax
c010c036:	89 44 24 04          	mov    %eax,0x4(%esp)
c010c03a:	c7 04 24 77 bf 10 c0 	movl   $0xc010bf77,(%esp)
c010c041:	e8 53 fb ff ff       	call   c010bb99 <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
c010c046:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010c049:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
c010c04c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010c04f:	c9                   	leave  
c010c050:	c3                   	ret    

c010c051 <hash32>:
 * @bits:   the number of bits in a return value
 *
 * High bits are more random, so we use them.
 * */
uint32_t
hash32(uint32_t val, unsigned int bits) {
c010c051:	f3 0f 1e fb          	endbr32 
c010c055:	55                   	push   %ebp
c010c056:	89 e5                	mov    %esp,%ebp
c010c058:	83 ec 10             	sub    $0x10,%esp
    uint32_t hash = val * GOLDEN_RATIO_PRIME_32;
c010c05b:	8b 45 08             	mov    0x8(%ebp),%eax
c010c05e:	69 c0 01 00 37 9e    	imul   $0x9e370001,%eax,%eax
c010c064:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (hash >> (32 - bits));
c010c067:	b8 20 00 00 00       	mov    $0x20,%eax
c010c06c:	2b 45 0c             	sub    0xc(%ebp),%eax
c010c06f:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010c072:	88 c1                	mov    %al,%cl
c010c074:	d3 ea                	shr    %cl,%edx
c010c076:	89 d0                	mov    %edx,%eax
}
c010c078:	c9                   	leave  
c010c079:	c3                   	ret    

c010c07a <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
c010c07a:	f3 0f 1e fb          	endbr32 
c010c07e:	55                   	push   %ebp
c010c07f:	89 e5                	mov    %esp,%ebp
c010c081:	57                   	push   %edi
c010c082:	56                   	push   %esi
c010c083:	53                   	push   %ebx
c010c084:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
c010c087:	a1 00 eb 12 c0       	mov    0xc012eb00,%eax
c010c08c:	8b 15 04 eb 12 c0    	mov    0xc012eb04,%edx
c010c092:	69 fa 6d e6 ec de    	imul   $0xdeece66d,%edx,%edi
c010c098:	6b f0 05             	imul   $0x5,%eax,%esi
c010c09b:	01 fe                	add    %edi,%esi
c010c09d:	bf 6d e6 ec de       	mov    $0xdeece66d,%edi
c010c0a2:	f7 e7                	mul    %edi
c010c0a4:	01 d6                	add    %edx,%esi
c010c0a6:	89 f2                	mov    %esi,%edx
c010c0a8:	83 c0 0b             	add    $0xb,%eax
c010c0ab:	83 d2 00             	adc    $0x0,%edx
c010c0ae:	89 c7                	mov    %eax,%edi
c010c0b0:	83 e7 ff             	and    $0xffffffff,%edi
c010c0b3:	89 f9                	mov    %edi,%ecx
c010c0b5:	0f b7 da             	movzwl %dx,%ebx
c010c0b8:	89 0d 00 eb 12 c0    	mov    %ecx,0xc012eb00
c010c0be:	89 1d 04 eb 12 c0    	mov    %ebx,0xc012eb04
    unsigned long long result = (next >> 12);
c010c0c4:	a1 00 eb 12 c0       	mov    0xc012eb00,%eax
c010c0c9:	8b 15 04 eb 12 c0    	mov    0xc012eb04,%edx
c010c0cf:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c010c0d3:	c1 ea 0c             	shr    $0xc,%edx
c010c0d6:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010c0d9:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
c010c0dc:	c7 45 dc 00 00 00 80 	movl   $0x80000000,-0x24(%ebp)
c010c0e3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010c0e6:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010c0e9:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010c0ec:	89 55 e8             	mov    %edx,-0x18(%ebp)
c010c0ef:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010c0f2:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010c0f5:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010c0f9:	74 1c                	je     c010c117 <rand+0x9d>
c010c0fb:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010c0fe:	ba 00 00 00 00       	mov    $0x0,%edx
c010c103:	f7 75 dc             	divl   -0x24(%ebp)
c010c106:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010c109:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010c10c:	ba 00 00 00 00       	mov    $0x0,%edx
c010c111:	f7 75 dc             	divl   -0x24(%ebp)
c010c114:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010c117:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010c11a:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010c11d:	f7 75 dc             	divl   -0x24(%ebp)
c010c120:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010c123:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c010c126:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010c129:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010c12c:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010c12f:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010c132:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
c010c135:	83 c4 24             	add    $0x24,%esp
c010c138:	5b                   	pop    %ebx
c010c139:	5e                   	pop    %esi
c010c13a:	5f                   	pop    %edi
c010c13b:	5d                   	pop    %ebp
c010c13c:	c3                   	ret    

c010c13d <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
c010c13d:	f3 0f 1e fb          	endbr32 
c010c141:	55                   	push   %ebp
c010c142:	89 e5                	mov    %esp,%ebp
    next = seed;
c010c144:	8b 45 08             	mov    0x8(%ebp),%eax
c010c147:	ba 00 00 00 00       	mov    $0x0,%edx
c010c14c:	a3 00 eb 12 c0       	mov    %eax,0xc012eb00
c010c151:	89 15 04 eb 12 c0    	mov    %edx,0xc012eb04
}
c010c157:	90                   	nop
c010c158:	5d                   	pop    %ebp
c010c159:	c3                   	ret    
